{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Others"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tensorflow as tf\n",
    "gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.3)\n",
    "sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Fig. 3(a). Corr:0.8, BP(25)-CNN-BP(25), baseline, SNR: -3.0~0.0 (Wrong!)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to GenData\n",
      "Corr para is set to 0.80\n",
      "eval_SNRs is set to [-3.  -2.5 -2.  -1.5 -1.  -0.5  0. ]\n",
      "Corr para for simulation is set to 0.80\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [-3.  -2.5 -2.  -1.5 -1.  -0.5  0. ].\n",
      "Correlation function of channel noise: \n",
      "[0.99999976 0.79999995 0.6399999  0.51199967 0.40959996 0.32768005\n",
      " 0.26214397 0.20971522 0.16777213 0.13421775]\n",
      "2018-06-07 10:40:48.848498: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 10:40:49.600278: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 10:40:49.600346: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 10:40:49.880455: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 10:40:49.880504: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 10:40:49.880512: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 10:40:49.880975: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 10:40:51.352295: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 10:40:51.352364: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 10:40:51.352375: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 10:40:51.352380: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 10:40:51.352647: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 10:40:51.368536: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 10:40:51.368564: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 10:40:51.368572: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 10:40:51.368576: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 10:40:51.368769: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 1004s\n",
      "end\n",
      "Close a tf session!\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 10:57:37.378662: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 10:57:37.378725: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 10:57:37.378735: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 10:57:37.378742: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 10:57:37.379055: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 10:57:37.410052: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 10:57:37.410109: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 10:57:37.410118: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 10:57:37.410126: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 10:57:37.410364: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 46s\n",
      "end\n",
      "Close a tf session!\n",
      "Finished GenData!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func GenData -CorrPara 0.8 -EvalSNR \"-3 -2.5 -2 -1.5 -1 -0.5 0\" -SimuCorrPara 0.8 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"-3 -2.5 -2 -1.5 -1 -0.5 0\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Train\n",
      "Corr para is set to 0.80\n",
      "eval_SNRs is set to [-3.  -2.5 -2.  -1.5 -1.  -0.5  0. ]\n",
      "Corr para for simulation is set to 0.80\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [-3.  -2.5 -2.  -1.5 -1.  -0.5  0. ].\n",
      "Construct the data IO class for training!\n",
      "\n",
      "2018-06-07 10:58:28.676222: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 10:58:29.317703: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 10:58:29.317741: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 10:58:29.612834: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 10:58:29.612894: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 10:58:29.612902: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 10:58:29.613410: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Test loss: 0.726677, orig loss: 0.459360\n",
      "Iteration\tLoss\n",
      "500\n",
      "0.11950976997613907\n",
      "1000\n",
      "0.11260838707288107\n",
      "1500\n",
      "0.10947308291991552\n",
      "2000\n",
      "0.10754405980308851\n",
      "2500\n",
      "0.10630522718032201\n",
      "3000\n",
      "0.10511612345774969\n",
      "3500\n",
      "0.10410482262571653\n",
      "4000\n",
      "0.10327103262146314\n",
      "4500\n",
      "0.10254287794232368\n",
      "5000\n",
      "0.10201638241608937\n",
      "5500\n",
      "0.10173623984058698\n",
      "6000\n",
      "0.10122306471069654\n",
      "6500\n",
      "0.10084258889158566\n",
      "7000\n",
      "0.10047032609581948\n",
      "7500\n",
      "0.10024127687017123\n",
      "8000\n",
      "0.10004109566410382\n",
      "8500\n",
      "0.09974743922551473\n",
      "9000\n",
      "0.09956651156147321\n",
      "9500\n",
      "0.09967074890931447\n",
      "10000\n",
      "0.0993917519847552\n",
      "10500\n",
      "0.09904752348860105\n",
      "11000\n",
      "0.09907488177220027\n",
      "11500\n",
      "0.09883830472826957\n",
      "12000\n",
      "0.09894034390648206\n",
      "12500\n",
      "0.09875949745376905\n",
      "13000\n",
      "0.09851670836408934\n",
      "13500\n",
      "0.09860897461573283\n",
      "14000\n",
      "0.09857477967937787\n",
      "14500\n",
      "0.09898422434926032\n",
      "15000\n",
      "0.0983742892742157\n",
      "15500\n",
      "0.09811315362652143\n",
      "16000\n",
      "0.09835287804404895\n",
      "16500\n",
      "0.09805388922492662\n",
      "17000\n",
      "0.09797321061293283\n",
      "17500\n",
      "0.09813621565699578\n",
      "18000\n",
      "0.09791439076264699\n",
      "18500\n",
      "0.09782876819372177\n",
      "19000\n",
      "0.09777064422766367\n",
      "19500\n",
      "0.09770427743593851\n",
      "20000\n",
      "0.09787335743506749\n",
      "20500\n",
      "0.09763084674874942\n",
      "21000\n",
      "0.09781275391578674\n",
      "21500\n",
      "0.09748779808481535\n",
      "22000\n",
      "0.0976032388707002\n",
      "22500\n",
      "0.09756967723369599\n",
      "23000\n",
      "0.09746728340784709\n",
      "23500\n",
      "0.09758638367056846\n",
      "24000\n",
      "0.09739347447951635\n",
      "24500\n",
      "0.09735773379604022\n",
      "25000\n",
      "0.09733273436625799\n",
      "25500\n",
      "0.09730819662412007\n",
      "26000\n",
      "0.0976170373459657\n",
      "26500\n",
      "0.09737396116058032\n",
      "27000\n",
      "0.09731764569878579\n",
      "27500\n",
      "0.09731577262282372\n",
      "28000\n",
      "0.09730636676152547\n",
      "28500\n",
      "0.09741370677947998\n",
      "29000\n",
      "0.09718552355964978\n",
      "29500\n",
      "0.09734479909141859\n",
      "30000\n",
      "0.09715805972615878\n",
      "30500\n",
      "0.09710237060983976\n",
      "31000\n",
      "0.09754369308551153\n",
      "31500\n",
      "0.09707575490077337\n",
      "32000\n",
      "0.09713365559776624\n",
      "32500\n",
      "0.09699074402451516\n",
      "33000\n",
      "0.09696656713883083\n",
      "33500\n",
      "0.09706158389647802\n",
      "34000\n",
      "0.09693183129032452\n",
      "34500\n",
      "0.0970055545369784\n",
      "35000\n",
      "0.09713366677363713\n",
      "35500\n",
      "0.09694595883289973\n",
      "36000\n",
      "0.09694673741857211\n",
      "36500\n",
      "0.09707195286949476\n",
      "37000\n",
      "0.09709335391720136\n",
      "37500\n",
      "0.09686163912216822\n",
      "38000\n",
      "0.09702040652434031\n",
      "38500\n",
      "0.09679798459013303\n",
      "39000\n",
      "0.09686706811189652\n",
      "39500\n",
      "0.09700604801376661\n",
      "40000\n",
      "0.096820996205012\n",
      "40500\n",
      "0.09700976510842642\n",
      "41000\n",
      "0.09677585537234942\n",
      "41500\n",
      "0.09707575092713037\n",
      "42000\n",
      "0.09671430811285972\n",
      "42500\n",
      "0.09675714472929636\n",
      "43000\n",
      "0.09711239983638127\n",
      "43500\n",
      "0.09672306800882022\n",
      "44000\n",
      "0.09664798155426979\n",
      "44500\n",
      "0.09666141892472903\n",
      "45000\n",
      "0.09679748217264811\n",
      "45500\n",
      "0.09695198908448219\n",
      "46000\n",
      "0.09665782848993937\n",
      "46500\n",
      "0.09690819904208184\n",
      "47000\n",
      "0.09661620954672495\n",
      "47500\n",
      "0.0967879352470239\n",
      "48000\n",
      "0.0965974176923434\n",
      "48500\n",
      "0.09673717642823855\n",
      "49000\n",
      "0.09662213549017906\n",
      "49500\n",
      "0.09662862544258435\n",
      "50000\n",
      "0.0965885433057944\n",
      "50500\n",
      "0.09665018270413081\n",
      "51000\n",
      "0.0970511424044768\n",
      "51500\n",
      "0.09652605379621187\n",
      "52000\n",
      "0.0965004250407219\n",
      "52500\n",
      "0.09650816346208255\n",
      "53000\n",
      "0.09665118033687274\n",
      "53500\n",
      "0.09657313600182534\n",
      "54000\n",
      "0.09649244820078214\n",
      "54500\n",
      "0.09652007520198821\n",
      "55000\n",
      "0.09649891753991445\n",
      "55500\n",
      "0.09665749371051788\n",
      "56000\n",
      "0.0964502605299155\n",
      "56500\n",
      "0.09647544001539549\n",
      "57000\n",
      "0.09696612680951754\n",
      "57500\n",
      "0.09655694762865702\n",
      "58000\n",
      "0.09641735826929411\n",
      "58500\n",
      "0.0965188317000866\n",
      "59000\n",
      "0.09645537162820499\n",
      "59500\n",
      "0.09642181421319644\n",
      "60000\n",
      "0.09637086341778438\n",
      "60500\n",
      "0.09645038023591042\n",
      "61000\n",
      "0.09668450703223547\n",
      "61500\n",
      "0.09637129083275794\n",
      "62000\n",
      "0.09657954374949138\n",
      "62500\n",
      "0.09645485604802767\n",
      "63000\n",
      "0.09636368205149969\n",
      "63500\n",
      "0.09641084745526314\n",
      "64000\n",
      "0.09660427570343018\n",
      "64500\n",
      "0.09633511876066526\n",
      "65000\n",
      "0.09634941220283508\n",
      "65500\n",
      "0.09648720771074296\n",
      "66000\n",
      "0.09630609651406606\n",
      "66500\n",
      "0.09631425440311432\n",
      "67000\n",
      "0.09628766228755316\n",
      "67500\n",
      "0.0964045616487662\n",
      "68000\n",
      "0.09635849719246228\n",
      "68500\n",
      "0.0964110183219115\n",
      "69000\n",
      "0.09644953459501267\n",
      "69500\n",
      "0.09640238210558891\n",
      "70000\n",
      "0.09637960344552994\n",
      "70500\n",
      "0.09630298813184103\n",
      "71000\n",
      "0.09654396325349808\n",
      "Save 4 layers.\n",
      "\n",
      "Final minimum loss: 0.096288\n",
      "Used time for training: 2019s\n",
      "Delete the data IO class!\n",
      "\n",
      "Finished Train!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Train -CorrPara 0.8 -EvalSNR \"-3 -2.5 -2 -1.5 -1 -0.5 0\" -SimuCorrPara 0.8 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"-3 -2.5 -2 -1.5 -1 -0.5 0\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Simulation\n",
      "Corr para is set to 0.80\n",
      "eval_SNRs is set to [-3.  -2.5 -2.  -1.5 -1.  -0.5  0. ]\n",
      "Corr para for simulation is set to 0.80\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [-3.  -2.5 -2.  -1.5 -1.  -0.5  0. ].\n",
      "Correlation function of channel noise: \n",
      "[0.99999976 0.79999995 0.6399999  0.51199967 0.40959996 0.32768005\n",
      " 0.26214397 0.20971522 0.16777213 0.13421775]\n",
      "2018-06-07 11:32:07.829841: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 11:32:08.630302: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 11:32:08.630359: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 11:32:08.954241: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 11:32:08.954303: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 11:32:08.954311: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 11:32:08.954746: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Real simutimes: 15000\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 11:32:10.873604: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 11:32:10.873686: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 11:32:10.873714: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 11:32:10.873721: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 11:32:10.874046: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 11:32:11.159430: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 11:32:11.159507: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 11:32:11.159535: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 11:32:11.159559: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 11:32:11.159759: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Time: 41s\n",
      "end\n",
      "\n",
      "Close a tf session!\n",
      "Correlation function of channel noise: \n",
      "[0.99999976 0.79999995 0.6399999  0.51199967 0.40959996 0.32768005\n",
      " 0.26214397 0.20971522 0.16777213 0.13421775]\n",
      "2018-06-07 11:32:52.629935: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 11:32:52.629979: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 11:32:52.629992: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 11:32:52.630016: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 11:32:52.630251: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 11:32:54.234977: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 11:32:54.235077: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 11:32:54.235087: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 11:32:54.235094: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 11:32:54.235416: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 11:32:54.684157: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 11:32:54.684228: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 11:32:54.684237: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 11:32:54.684260: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 11:32:54.685260: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch 0 in total 47 batches. Practical EbN0: -2.99\n",
      "Batch 1 in total 47 batches. Practical EbN0: -3.01\n",
      "Batch 2 in total 47 batches. Practical EbN0: -3.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: -3.01\n",
      "Batch 4 in total 47 batches. Practical EbN0: -3.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: -2.49\n",
      "Batch 1 in total 47 batches. Practical EbN0: -2.51\n",
      "Batch 2 in total 47 batches. Practical EbN0: -2.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: -2.51\n",
      "Batch 4 in total 47 batches. Practical EbN0: -2.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: -1.99\n",
      "Batch 1 in total 47 batches. Practical EbN0: -2.01\n",
      "Batch 2 in total 47 batches. Practical EbN0: -2.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: -2.01\n",
      "Batch 4 in total 47 batches. Practical EbN0: -2.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: -1.49\n",
      "Batch 1 in total 47 batches. Practical EbN0: -1.51\n",
      "Batch 2 in total 47 batches. Practical EbN0: -1.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: -1.51\n",
      "Batch 4 in total 47 batches. Practical EbN0: -1.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: -0.99\n",
      "Batch 1 in total 47 batches. Practical EbN0: -1.01\n",
      "Batch 2 in total 47 batches. Practical EbN0: -1.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: -1.01\n",
      "Batch 4 in total 47 batches. Practical EbN0: -1.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: -0.49\n",
      "Batch 1 in total 47 batches. Practical EbN0: -0.51\n",
      "Batch 2 in total 47 batches. Practical EbN0: -0.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: -0.51\n",
      "Batch 4 in total 47 batches. Practical EbN0: -0.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.01\n",
      "Batch 1 in total 47 batches. Practical EbN0: -0.01\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Batch 2 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 4 in total 47 batches. Practical EbN0: -0.00\n",
      "10800000 bits are simulated!\n",
      "Time: 79s\n",
      "end\n",
      "\n",
      "Close the tf session!\n",
      "Close a tf session!\n",
      "Finished Simulation!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Simulation -CorrPara 0.8 -EvalSNR \"-3 -2.5 -2 -1.5 -1 -0.5 0\" -SimuCorrPara 0.8 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"-3 -2.5 -2 -1.5 -1 -0.5 0\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Fig. 3(a). Corr:0.8, BP(25)-CNN-BP(25), enhanced, SNR: -3.0~0.0 (Correct!)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to GenData\n",
      "Corr para is set to 0.80\n",
      "eval_SNRs is set to [-3.  -2.5 -2.  -1.5 -1.  -0.5  0. ]\n",
      "Corr para for simulation is set to 0.80\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: True\n",
      "Normality lambda is set to 0.100000\n",
      "SNR set for generating data is set to [-3.  -2.5 -2.  -1.5 -1.  -0.5  0. ].\n",
      "Correlation function of channel noise: \n",
      "[0.99999976 0.79999995 0.6399999  0.51199967 0.40959996 0.32768005\n",
      " 0.26214397 0.20971522 0.16777213 0.13421775]\n",
      "2018-06-06 10:58:23.123755: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-06 10:58:23.930127: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 14.81GiB\n",
      "2018-06-06 10:58:23.930169: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 10:58:24.222782: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 10:58:24.222827: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 10:58:24.222852: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 10:58:24.223269: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14337 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-06 10:58:25.656917: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 10:58:25.657018: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 10:58:25.657049: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 10:58:25.657060: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 10:58:25.657334: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14337 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-06 10:58:25.676932: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 10:58:25.677028: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 10:58:25.677038: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 10:58:25.677061: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 10:58:25.677273: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14337 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 1013s\n",
      "end\n",
      "Close a tf session!\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-06 11:15:19.689501: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 11:15:19.689563: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 11:15:19.689573: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 11:15:19.689579: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 11:15:19.689888: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14337 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-06 11:15:19.722376: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 11:15:19.722426: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 11:15:19.722434: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 11:15:19.722438: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 11:15:19.722698: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14337 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 43s\n",
      "end\n",
      "Close a tf session!\n",
      "Finished GenData!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func GenData -CorrPara 0.8 -EvalSNR \"-3 -2.5 -2 -1.5 -1 -0.5 0\" -SimuCorrPara 0.8 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest True -NormLambda 0.1 -SNR_GenData \"-3 -2.5 -2 -1.5 -1 -0.5 0\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Train\n",
      "Corr para is set to 0.80\n",
      "eval_SNRs is set to [-3.  -2.5 -2.  -1.5 -1.  -0.5  0. ]\n",
      "Corr para for simulation is set to 0.80\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: True\n",
      "Normality lambda is set to 0.100000\n",
      "SNR set for generating data is set to [-3.  -2.5 -2.  -1.5 -1.  -0.5  0. ].\n",
      "Construct the data IO class for training!\n",
      "\n",
      "2018-06-06 11:16:08.019407: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-06 11:16:08.678318: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 14.81GiB\n",
      "2018-06-06 11:16:08.678385: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 11:16:08.985753: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 11:16:08.985795: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 11:16:08.985804: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 11:16:08.986247: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14337 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Test loss: 0.805296, orig loss: 2.741571\n",
      "Iteration\tLoss\n",
      "500\n",
      "0.23637684434652328\n",
      "1000\n",
      "0.22838299324115116\n",
      "1500\n",
      "0.2259665384888649\n",
      "2000\n",
      "0.2251044477025668\n",
      "2500\n",
      "0.2240632618467013\n",
      "3000\n",
      "0.22356061935424804\n",
      "3500\n",
      "0.22330359121163687\n",
      "4000\n",
      "0.2225839118162791\n",
      "4500\n",
      "0.22233254164457322\n",
      "5000\n",
      "0.22175551652908326\n",
      "5500\n",
      "0.22137874762217205\n",
      "6000\n",
      "0.22101927548646927\n",
      "6500\n",
      "0.22075473467508952\n",
      "7000\n",
      "0.22038561304410298\n",
      "7500\n",
      "0.22044332722822826\n",
      "8000\n",
      "0.22003529767195384\n",
      "8500\n",
      "0.21987819224596022\n",
      "9000\n",
      "0.2200274591644605\n",
      "9500\n",
      "0.21989102860291798\n",
      "10000\n",
      "0.2194953555862109\n",
      "10500\n",
      "0.2194530785083771\n",
      "11000\n",
      "0.21924877762794495\n",
      "11500\n",
      "0.21970253437757492\n",
      "12000\n",
      "0.2191974843541781\n",
      "12500\n",
      "0.21905321379502615\n",
      "13000\n",
      "0.21946140229701996\n",
      "13500\n",
      "0.21952037413915\n",
      "14000\n",
      "0.21893551697333655\n",
      "14500\n",
      "0.21887465516726176\n",
      "15000\n",
      "0.21886069526274998\n",
      "15500\n",
      "0.2190569207072258\n",
      "16000\n",
      "0.2188972309231758\n",
      "16500\n",
      "0.21866532564163207\n",
      "17000\n",
      "0.218786758184433\n",
      "17500\n",
      "0.2189289097984632\n",
      "18000\n",
      "0.21861251095930737\n",
      "18500\n",
      "0.21875543842713038\n",
      "19000\n",
      "0.2187017207344373\n",
      "19500\n",
      "0.21924821883440018\n",
      "20000\n",
      "0.21848743160565695\n",
      "20500\n",
      "0.21849561234315237\n",
      "21000\n",
      "0.21843520253896714\n",
      "21500\n",
      "0.21896725396315256\n",
      "22000\n",
      "0.21850797633330027\n",
      "22500\n",
      "0.2184257447719574\n",
      "23000\n",
      "0.21886607656876247\n",
      "23500\n",
      "0.2184003805120786\n",
      "24000\n",
      "0.21861671457688014\n",
      "24500\n",
      "0.21839544276396433\n",
      "25000\n",
      "0.21851992805798848\n",
      "25500\n",
      "0.21820686558882396\n",
      "26000\n",
      "0.21832839002211887\n",
      "26500\n",
      "0.218192291756471\n",
      "27000\n",
      "0.2181440755724907\n",
      "27500\n",
      "0.21822162717580795\n",
      "28000\n",
      "0.21818285137414933\n",
      "28500\n",
      "0.2183444326122602\n",
      "29000\n",
      "0.21823332856098812\n",
      "29500\n",
      "0.21816829641660054\n",
      "30000\n",
      "0.2182501311103503\n",
      "30500\n",
      "0.21842900216579436\n",
      "31000\n",
      "0.21802690029144287\n",
      "31500\n",
      "0.21807580888271333\n",
      "32000\n",
      "0.21805919955174127\n",
      "32500\n",
      "0.2179982254902522\n",
      "33000\n",
      "0.2179970324039459\n",
      "33500\n",
      "0.21796563714742662\n",
      "34000\n",
      "0.21793687989314398\n",
      "34500\n",
      "0.21801310777664185\n",
      "35000\n",
      "0.21807655493418376\n",
      "35500\n",
      "0.2181509460012118\n",
      "36000\n",
      "0.2178748552997907\n",
      "36500\n",
      "0.2179986447095871\n",
      "37000\n",
      "0.21807381113370258\n",
      "37500\n",
      "0.21793878475824993\n",
      "38000\n",
      "0.2185928612947464\n",
      "38500\n",
      "0.21796562125285465\n",
      "39000\n",
      "0.21771730532248815\n",
      "39500\n",
      "0.21781173646450042\n",
      "40000\n",
      "0.21771109302838643\n",
      "40500\n",
      "0.21793724745512008\n",
      "41000\n",
      "0.21779711643854777\n",
      "41500\n",
      "0.21772702485322953\n",
      "42000\n",
      "0.21777510146299997\n",
      "42500\n",
      "0.21766976217428843\n",
      "43000\n",
      "0.21782328685124716\n",
      "43500\n",
      "0.21768454263607662\n",
      "44000\n",
      "0.2177448684970538\n",
      "44500\n",
      "0.2178800289829572\n",
      "45000\n",
      "0.2177111715078354\n",
      "45500\n",
      "0.21765651454528173\n",
      "46000\n",
      "0.21774973273277282\n",
      "46500\n",
      "0.21766891380151113\n",
      "47000\n",
      "0.21783231844504675\n",
      "47500\n",
      "0.21791337976853054\n",
      "48000\n",
      "0.2176646575331688\n",
      "48500\n",
      "0.2184543381134669\n",
      "49000\n",
      "0.21760128537813822\n",
      "49500\n",
      "0.2177154411872228\n",
      "50000\n",
      "0.2177700564265251\n",
      "50500\n",
      "0.21765542328357695\n",
      "51000\n",
      "0.2175607328613599\n",
      "51500\n",
      "0.21753444174925488\n",
      "52000\n",
      "0.2175910696387291\n",
      "52500\n",
      "0.21751329451799392\n",
      "53000\n",
      "0.21763270845015845\n",
      "53500\n",
      "0.21753039211034775\n",
      "54000\n",
      "0.21749075253804526\n",
      "54500\n",
      "0.21752492040395738\n",
      "55000\n",
      "0.21768204222122828\n",
      "55500\n",
      "0.2174539566040039\n",
      "56000\n",
      "0.21757381012042362\n",
      "56500\n",
      "0.2176884318391482\n",
      "57000\n",
      "0.2178112457195918\n",
      "57500\n",
      "0.21752235641082127\n",
      "58000\n",
      "0.2176825205485026\n",
      "58500\n",
      "0.21794831802447637\n",
      "59000\n",
      "0.21756060918172201\n",
      "59500\n",
      "0.21739700585603713\n",
      "60000\n",
      "0.2176518052816391\n",
      "60500\n",
      "0.21766198525826136\n",
      "61000\n",
      "0.21755682031313578\n",
      "61500\n",
      "0.21750815411408742\n",
      "62000\n",
      "0.2176511550943057\n",
      "62500\n",
      "0.21747277826070785\n",
      "63000\n",
      "0.21792763322591782\n",
      "63500\n",
      "0.21736575166384378\n",
      "64000\n",
      "0.21737497945626577\n",
      "64500\n",
      "0.21756383925676345\n",
      "65000\n",
      "0.2174377237757047\n",
      "65500\n",
      "0.21740606178840002\n",
      "66000\n",
      "0.21734599272410074\n",
      "66500\n",
      "0.21761216620604198\n",
      "67000\n",
      "0.21789520382881164\n",
      "67500\n",
      "0.2173850044608116\n",
      "68000\n",
      "0.21743173400561014\n",
      "68500\n",
      "0.21734735171000164\n",
      "69000\n",
      "0.21726571122805277\n",
      "69500\n",
      "0.21732908934354783\n",
      "70000\n",
      "0.21719704568386078\n",
      "70500\n",
      "0.21721409857273102\n",
      "71000\n",
      "0.21727314392725627\n",
      "71500\n",
      "0.21728752950827282\n",
      "72000\n",
      "0.21725891679525375\n",
      "72500\n",
      "0.21739771614472073\n",
      "73000\n",
      "0.2174118846654892\n",
      "73500\n",
      "0.21718782236178716\n",
      "74000\n",
      "0.21730366746584576\n",
      "74500\n",
      "0.217220705250899\n",
      "75000\n",
      "0.21722728808720906\n",
      "75500\n",
      "0.217344968020916\n",
      "76000\n",
      "0.2171303927898407\n",
      "76500\n",
      "0.2171286513408025\n",
      "77000\n",
      "0.2172432432572047\n",
      "77500\n",
      "0.21729993373155593\n",
      "78000\n",
      "0.2174707089861234\n",
      "78500\n",
      "0.21743074854214986\n",
      "79000\n",
      "0.21725468585888544\n",
      "79500\n",
      "0.21751728455225627\n",
      "80000\n",
      "0.2171763688325882\n",
      "80500\n",
      "0.21722610195477804\n",
      "Save 4 layers.\n",
      "\n",
      "Final minimum loss: 0.217129\n",
      "Used time for training: 2396s\n",
      "Delete the data IO class!\n",
      "\n",
      "Finished Train!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Train -CorrPara 0.8 -EvalSNR \"-3 -2.5 -2 -1.5 -1 -0.5 0\" -SimuCorrPara 0.8 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest True -NormLambda 0.1 -SNR_GenData \"-3 -2.5 -2 -1.5 -1 -0.5 0\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Simulation\n",
      "Corr para is set to 0.80\n",
      "eval_SNRs is set to [-3.  -2.5 -2.  -1.5 -1.  -0.5  0. ]\n",
      "Corr para for simulation is set to 0.80\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: True\n",
      "Normality lambda is set to 0.100000\n",
      "SNR set for generating data is set to [-3.  -2.5 -2.  -1.5 -1.  -0.5  0. ].\n",
      "Correlation function of channel noise: \n",
      "[0.99999976 0.79999995 0.6399999  0.51199967 0.40959996 0.32768005\n",
      " 0.26214397 0.20971522 0.16777213 0.13421775]\n",
      "2018-06-06 11:56:03.842077: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-06 11:56:04.611579: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 14.81GiB\n",
      "2018-06-06 11:56:04.611661: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 11:56:04.909501: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 11:56:04.909556: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 11:56:04.909563: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 11:56:04.910113: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14337 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Real simutimes: 15000\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-06 11:56:06.715121: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 11:56:06.715229: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 11:56:06.715239: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 11:56:06.715246: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 11:56:06.716372: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14337 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-06 11:56:06.979258: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 11:56:06.979329: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 11:56:06.979339: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 11:56:06.979362: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 11:56:06.979644: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14337 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Time: 37s\n",
      "end\n",
      "\n",
      "Close a tf session!\n",
      "Correlation function of channel noise: \n",
      "[0.99999976 0.79999995 0.6399999  0.51199967 0.40959996 0.32768005\n",
      " 0.26214397 0.20971522 0.16777213 0.13421775]\n",
      "2018-06-06 11:56:45.208445: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 11:56:45.208499: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 11:56:45.208515: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 11:56:45.208529: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 11:56:45.303848: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14337 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-06 11:56:46.862797: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 11:56:46.862875: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 11:56:46.862902: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 11:56:46.862908: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 11:56:46.864183: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14337 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-06 11:56:47.265693: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 11:56:47.265751: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 11:56:47.265762: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 11:56:47.265770: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 11:56:47.266008: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14337 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch 0 in total 47 batches. Practical EbN0: -2.99\n",
      "Batch 1 in total 47 batches. Practical EbN0: -3.01\n",
      "Batch 2 in total 47 batches. Practical EbN0: -3.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: -3.01\n",
      "Batch 4 in total 47 batches. Practical EbN0: -3.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: -2.49\n",
      "Batch 1 in total 47 batches. Practical EbN0: -2.51\n",
      "Batch 2 in total 47 batches. Practical EbN0: -2.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: -2.51\n",
      "Batch 4 in total 47 batches. Practical EbN0: -2.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: -1.99\n",
      "Batch 1 in total 47 batches. Practical EbN0: -2.01\n",
      "Batch 2 in total 47 batches. Practical EbN0: -2.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: -2.01\n",
      "Batch 4 in total 47 batches. Practical EbN0: -2.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: -1.49\n",
      "Batch 1 in total 47 batches. Practical EbN0: -1.51\n",
      "Batch 2 in total 47 batches. Practical EbN0: -1.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: -1.51\n",
      "Batch 4 in total 47 batches. Practical EbN0: -1.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: -0.99\n",
      "Batch 1 in total 47 batches. Practical EbN0: -1.01\n",
      "Batch 2 in total 47 batches. Practical EbN0: -1.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: -1.01\n",
      "Batch 4 in total 47 batches. Practical EbN0: -1.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: -0.49\n",
      "Batch 1 in total 47 batches. Practical EbN0: -0.51\n",
      "Batch 2 in total 47 batches. Practical EbN0: -0.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: -0.51\n",
      "Batch 4 in total 47 batches. Practical EbN0: -0.50\n",
      "Batch 5 in total 47 batches. Practical EbN0: -0.50\n",
      "Batch 6 in total 47 batches. Practical EbN0: -0.50\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Batch 7 in total 47 batches. Practical EbN0: -0.48\n",
      "Batch 8 in total 47 batches. Practical EbN0: -0.50\n",
      "Batch 9 in total 47 batches. Practical EbN0: -0.49\n",
      "Batch 10 in total 47 batches. Practical EbN0: -0.51\n",
      "Batch 11 in total 47 batches. Practical EbN0: -0.49\n",
      "Batch 12 in total 47 batches. Practical EbN0: -0.51\n",
      "Batch 13 in total 47 batches. Practical EbN0: -0.50\n",
      "Batch 14 in total 47 batches. Practical EbN0: -0.51\n",
      "Batch 15 in total 47 batches. Practical EbN0: -0.50\n",
      "34560000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.01\n",
      "Batch 1 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 4 in total 47 batches. Practical EbN0: -0.00\n",
      "Batch 5 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 6 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 7 in total 47 batches. Practical EbN0: 0.02\n",
      "Batch 8 in total 47 batches. Practical EbN0: -0.00\n",
      "Batch 9 in total 47 batches. Practical EbN0: 0.01\n",
      "Batch 10 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 11 in total 47 batches. Practical EbN0: 0.01\n",
      "Batch 12 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 13 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 14 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 15 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 16 in total 47 batches. Practical EbN0: 0.01\n",
      "Batch 17 in total 47 batches. Practical EbN0: -0.00\n",
      "Batch 18 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 19 in total 47 batches. Practical EbN0: 0.01\n",
      "Batch 20 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 21 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 22 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 23 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 24 in total 47 batches. Practical EbN0: -0.00\n",
      "Batch 25 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 26 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 27 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 28 in total 47 batches. Practical EbN0: 0.01\n",
      "Batch 29 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 30 in total 47 batches. Practical EbN0: 0.02\n",
      "Batch 31 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 32 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 33 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 34 in total 47 batches. Practical EbN0: 0.01\n",
      "Batch 35 in total 47 batches. Practical EbN0: -0.02\n",
      "Batch 36 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 37 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 38 in total 47 batches. Practical EbN0: 0.00\n",
      "84240000 bits are simulated!\n",
      "Time: 175s\n",
      "end\n",
      "\n",
      "Close the tf session!\n",
      "Close a tf session!\n",
      "Finished Simulation!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Simulation -CorrPara 0.8 -EvalSNR \"-3 -2.5 -2 -1.5 -1 -0.5 0\" -SimuCorrPara 0.8 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest True -NormLambda 0.1 -SNR_GenData \"-3 -2.5 -2 -1.5 -1 -0.5 0\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Fig. 3(a). Corr:0.8, BP(50), SNR: 0.0~3.0 (Different.)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to GenData\n",
      "Corr para is set to 0.80\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.80\n",
      "BP iter for gen data is set to: [50]\n",
      "BP iter for simulation is set to: [50]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[0.99999976 0.79999995 0.6399999  0.51199967 0.40959996 0.32768005\n",
      " 0.26214397 0.20971522 0.16777213 0.13421775]\n",
      "2018-06-07 06:56:59.200229: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 06:56:59.930571: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 06:56:59.930619: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 06:57:00.229188: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 06:57:00.229233: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 06:57:00.229259: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 06:57:00.229734: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 06:57:01.561991: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 06:57:01.562050: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 06:57:01.562058: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 06:57:01.562065: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 06:57:01.562322: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 06:57:01.580787: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 06:57:01.580845: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 06:57:01.580855: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 06:57:01.580878: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 06:57:01.581090: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 1336s\n",
      "end\n",
      "Close a tf session!\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 07:19:19.143549: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 07:19:19.143674: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 07:19:19.143684: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 07:19:19.143707: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 07:19:19.143965: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 07:19:19.171606: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 07:19:19.171662: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 07:19:19.171672: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 07:19:19.171702: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 07:19:19.171960: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 53s\n",
      "end\n",
      "Close a tf session!\n",
      "Finished GenData!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func GenData -CorrPara 0.8 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.8 -BP_IterForGenData 50 -BP_IterForSimu \"50\" -NetNumber 0 -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Train\n",
      "Corr para is set to 0.80\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.80\n",
      "BP iter for gen data is set to: [50]\n",
      "BP iter for simulation is set to: [50]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Construct the data IO class for training!\n",
      "\n",
      "2018-06-07 07:20:17.308775: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 07:20:17.931990: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 07:20:17.932030: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 07:20:18.214666: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 07:20:18.214703: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 07:20:18.214710: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 07:20:18.215122: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Test loss: 0.692642, orig loss: 0.088643\n",
      "Iteration\tLoss\n",
      "500\n",
      "0.014086407795548438\n",
      "1000\n",
      "0.01098894008124868\n",
      "1500\n",
      "0.010183809449275334\n",
      "2000\n",
      "0.009606531293441852\n",
      "2500\n",
      "0.009210109151899815\n",
      "3000\n",
      "0.00888954180603226\n",
      "3500\n",
      "0.008631199691444635\n",
      "4000\n",
      "0.008498418983072043\n",
      "4500\n",
      "0.008258824174602827\n",
      "5000\n",
      "0.00820202035829425\n",
      "5500\n",
      "0.008035996897766988\n",
      "6000\n",
      "0.00790715697221458\n",
      "6500\n",
      "0.007834498956799506\n",
      "7000\n",
      "0.007767102696622411\n",
      "7500\n",
      "0.007751356453324357\n",
      "8000\n",
      "0.0076502216358979545\n",
      "8500\n",
      "0.0076190703082829716\n",
      "9000\n",
      "0.007568691608806451\n",
      "9500\n",
      "0.007525719283148646\n",
      "10000\n",
      "0.007487558914969365\n",
      "10500\n",
      "0.007673889336486658\n",
      "11000\n",
      "0.007436353961626689\n",
      "11500\n",
      "0.007408775963510076\n",
      "12000\n",
      "0.007503308402374387\n",
      "12500\n",
      "0.007377795518065492\n",
      "13000\n",
      "0.007404005387797952\n",
      "13500\n",
      "0.007365796063095331\n",
      "14000\n",
      "0.007284900033846497\n",
      "14500\n",
      "0.007276351982727647\n",
      "15000\n",
      "0.007283720374107361\n",
      "15500\n",
      "0.007258263370022178\n",
      "16000\n",
      "0.007219800570358832\n",
      "16500\n",
      "0.00724924070139726\n",
      "17000\n",
      "0.007231448761497935\n",
      "17500\n",
      "0.007171233169113596\n",
      "18000\n",
      "0.007172489600876967\n",
      "18500\n",
      "0.00713852186066409\n",
      "19000\n",
      "0.007157433917745948\n",
      "19500\n",
      "0.007117767725139857\n",
      "20000\n",
      "0.007174467062577605\n",
      "20500\n",
      "0.007116256592174371\n",
      "21000\n",
      "0.007099612553914388\n",
      "21500\n",
      "0.007106666251396139\n",
      "22000\n",
      "0.007080940172697107\n",
      "22500\n",
      "0.007106166348482172\n",
      "23000\n",
      "0.007106846027697126\n",
      "23500\n",
      "0.007076499393830696\n",
      "24000\n",
      "0.007157090166583657\n",
      "24500\n",
      "0.007046520725513498\n",
      "25000\n",
      "0.007050206620867054\n",
      "25500\n",
      "0.007030245444426934\n",
      "26000\n",
      "0.00703029059804976\n",
      "26500\n",
      "0.007019513395304481\n",
      "27000\n",
      "0.007037151837721467\n",
      "27500\n",
      "0.007048735565816363\n",
      "28000\n",
      "0.007035833333308498\n",
      "28500\n",
      "0.0070493835490196945\n",
      "29000\n",
      "0.007025948089237014\n",
      "29500\n",
      "0.007102278262997667\n",
      "30000\n",
      "0.007012790736431877\n",
      "30500\n",
      "0.006973487992460529\n",
      "31000\n",
      "0.006982089470451077\n",
      "31500\n",
      "0.007028546541308364\n",
      "32000\n",
      "0.0070536137713740265\n",
      "32500\n",
      "0.007072224390382568\n",
      "33000\n",
      "0.007014213440318902\n",
      "33500\n",
      "0.006985509411121408\n",
      "34000\n",
      "0.006957986780131857\n",
      "34500\n",
      "0.006950389050568144\n",
      "35000\n",
      "0.006959772016853094\n",
      "35500\n",
      "0.006986335897818208\n",
      "36000\n",
      "0.006954071329285701\n",
      "36500\n",
      "0.006964671115080516\n",
      "37000\n",
      "0.006940347701311111\n",
      "37500\n",
      "0.006921940421064695\n",
      "38000\n",
      "0.006957120820879936\n",
      "38500\n",
      "0.006930452104037007\n",
      "39000\n",
      "0.006940680866440137\n",
      "39500\n",
      "0.006937412234644095\n",
      "40000\n",
      "0.006974382667491833\n",
      "40500\n",
      "0.006931774054343502\n",
      "41000\n",
      "0.006922056898474693\n",
      "41500\n",
      "0.006978654069826007\n",
      "Save 4 layers.\n",
      "\n",
      "Final minimum loss: 0.006922\n",
      "Used time for training: 1222s\n",
      "Delete the data IO class!\n",
      "\n",
      "Finished Train!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Train -CorrPara 0.8 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.8 -BP_IterForGenData 50 -BP_IterForSimu \"50\" -NetNumber 0 -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Simulation\n",
      "Corr para is set to 0.80\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.80\n",
      "BP iter for gen data is set to: [50]\n",
      "BP iter for simulation is set to: [50]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[0.99999976 0.79999995 0.6399999  0.51199967 0.40959996 0.32768005\n",
      " 0.26214397 0.20971522 0.16777213 0.13421775]\n",
      "2018-06-07 07:40:39.471061: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 07:40:40.202232: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 07:40:40.202279: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 07:40:40.500305: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 07:40:40.500351: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 07:40:40.500359: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 07:40:40.501215: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Real simutimes: 15000\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 07:40:42.134103: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 07:40:42.134164: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 07:40:42.134174: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 07:40:42.134180: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 07:40:42.134434: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 07:40:42.395908: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 07:40:42.395970: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 07:40:42.395978: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 07:40:42.395985: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 07:40:42.396231: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Time: 45s\n",
      "end\n",
      "\n",
      "Close a tf session!\n",
      "Correlation function of channel noise: \n",
      "[0.99999976 0.79999995 0.6399999  0.51199967 0.40959996 0.32768005\n",
      " 0.26214397 0.20971522 0.16777213 0.13421775]\n",
      "2018-06-07 07:41:27.995213: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 07:41:27.995321: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 07:41:27.995353: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 07:41:27.995364: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 07:41:27.999687: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 07:41:29.459841: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 07:41:29.459909: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 07:41:29.459920: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 07:41:29.459943: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 07:41:29.460205: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 07:41:29.814357: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 07:41:29.814416: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 07:41:29.814426: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 07:41:29.814433: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 07:41:29.814703: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.01\n",
      "Batch 1 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: -0.01\n",
      "Batch 4 in total 47 batches. Practical EbN0: -0.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.51\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.49\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.49\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.01\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.99\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.99\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.51\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.49\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.49\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.01\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.99\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.99\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.51\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.49\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.49\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 2 in total 47 batches. Practical EbN0: 3.00\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Batch 3 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 4 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 5 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 6 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 7 in total 47 batches. Practical EbN0: 3.02\n",
      "Batch 8 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 9 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 10 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 11 in total 47 batches. Practical EbN0: 3.01\n",
      "25920000 bits are simulated!\n",
      "Time: 84s\n",
      "end\n",
      "\n",
      "Close the tf session!\n",
      "Close a tf session!\n",
      "Finished Simulation!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Simulation -CorrPara 0.8 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.8 -BP_IterForGenData 50 -BP_IterForSimu \"50\" -NetNumber 0 -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Fig. 3(b). Corr:0.5, BP(25)-CNN-BP(25), baseline, SNR: 0.0~3.0 (Different.)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to GenData\n",
      "Corr para is set to 0.50\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.50\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[1.         0.5        0.25000003 0.125      0.0625     0.03125\n",
      " 0.015625   0.0078125  0.00390625 0.00195313]\n",
      "2018-06-07 03:07:42.489868: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 03:07:43.225312: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 03:07:43.225351: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 03:07:43.524930: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 03:07:43.524973: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 03:07:43.524980: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 03:07:43.525465: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 03:07:44.769681: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 03:07:44.769748: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 03:07:44.769759: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 03:07:44.769763: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 03:07:44.770096: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 03:07:44.787237: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 03:07:44.787293: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 03:07:44.787302: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 03:07:44.787324: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 03:07:44.787577: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 1006s\n",
      "end\n",
      "Close a tf session!\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 03:24:32.065540: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 03:24:32.065602: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 03:24:32.065610: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 03:24:32.065615: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 03:24:32.065904: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 03:24:32.097747: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 03:24:32.097801: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 03:24:32.097809: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 03:24:32.097814: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 03:24:32.098063: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 44s\n",
      "end\n",
      "Close a tf session!\n",
      "Finished GenData!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func GenData -CorrPara 0.5 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.5 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Train\n",
      "Corr para is set to 0.50\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.50\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Construct the data IO class for training!\n",
      "\n",
      "2018-06-07 03:25:20.522799: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 03:25:21.145354: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 03:25:21.145393: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 03:25:21.424950: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 03:25:21.424984: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 03:25:21.425009: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 03:25:21.425619: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Test loss: 2.494973, orig loss: 0.086839\n",
      "Iteration\tLoss\n",
      "500\n",
      "0.06421592384576798\n",
      "1000\n",
      "0.06076875776052475\n",
      "1500\n",
      "0.060043954352537794\n",
      "2000\n",
      "0.05975190959870815\n",
      "2500\n",
      "0.05962396909793218\n",
      "3000\n",
      "0.05951611039539178\n",
      "3500\n",
      "0.05940993862847487\n",
      "4000\n",
      "0.059308174252510074\n",
      "4500\n",
      "0.059319451948006946\n",
      "5000\n",
      "0.059170146162311234\n",
      "5500\n",
      "0.05907944925129414\n",
      "6000\n",
      "0.05901956409215927\n",
      "6500\n",
      "0.05900123926500479\n",
      "7000\n",
      "0.05898081051806609\n",
      "7500\n",
      "0.05895396483441194\n",
      "8000\n",
      "0.05890350701908271\n",
      "8500\n",
      "0.05903579232593378\n",
      "9000\n",
      "0.05896671476463477\n",
      "9500\n",
      "0.058963063980142276\n",
      "10000\n",
      "0.05884932515521844\n",
      "10500\n",
      "0.058835124224424364\n",
      "11000\n",
      "0.05883233274022738\n",
      "11500\n",
      "0.058841927101214726\n",
      "12000\n",
      "0.05882847135265668\n",
      "12500\n",
      "0.05879155620932579\n",
      "13000\n",
      "0.058816077560186385\n",
      "13500\n",
      "0.05878760355214278\n",
      "14000\n",
      "0.05874925156434377\n",
      "14500\n",
      "0.05881347892185052\n",
      "15000\n",
      "0.05873979019622008\n",
      "15500\n",
      "0.05875484198331833\n",
      "16000\n",
      "0.05873657415310542\n",
      "16500\n",
      "0.058815197770794234\n",
      "17000\n",
      "0.05876219620307287\n",
      "17500\n",
      "0.0587333998332421\n",
      "18000\n",
      "0.05874307230114937\n",
      "18500\n",
      "0.05871441575388114\n",
      "19000\n",
      "0.0587394700696071\n",
      "19500\n",
      "0.05869075705607732\n",
      "20000\n",
      "0.05868910613159339\n",
      "20500\n",
      "0.05872694713373979\n",
      "21000\n",
      "0.05866697741051515\n",
      "21500\n",
      "0.05871123510102431\n",
      "22000\n",
      "0.05867170381049315\n",
      "22500\n",
      "0.058711201697587964\n",
      "23000\n",
      "0.0586618119229873\n",
      "23500\n",
      "0.05865455816189448\n",
      "24000\n",
      "0.058646351223190625\n",
      "24500\n",
      "0.05863374409576257\n",
      "25000\n",
      "0.058671981344620386\n",
      "25500\n",
      "0.05865687864522139\n",
      "26000\n",
      "0.058710153525074325\n",
      "26500\n",
      "0.05865371202429136\n",
      "27000\n",
      "0.058632791663209595\n",
      "27500\n",
      "0.05870315320789814\n",
      "28000\n",
      "0.05861200553675493\n",
      "28500\n",
      "0.05862933124105136\n",
      "29000\n",
      "0.05860230873028437\n",
      "29500\n",
      "0.058616952349742256\n",
      "30000\n",
      "0.058614463359117505\n",
      "30500\n",
      "0.05861709788441658\n",
      "31000\n",
      "0.05860712875922521\n",
      "31500\n",
      "0.05860270348687967\n",
      "32000\n",
      "0.05863519621392091\n",
      "32500\n",
      "0.05860651396214962\n",
      "33000\n",
      "0.0586655559639136\n",
      "Save 4 layers.\n",
      "\n",
      "Final minimum loss: 0.058602\n",
      "Used time for training: 928s\n",
      "Delete the data IO class!\n",
      "\n",
      "Finished Train!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Train -CorrPara 0.5 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.5 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Simulation\n",
      "Corr para is set to 0.50\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.50\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[1.         0.5        0.25000003 0.125      0.0625     0.03125\n",
      " 0.015625   0.0078125  0.00390625 0.00195313]\n",
      "2018-06-07 03:40:48.405777: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 03:40:49.095202: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 03:40:49.095240: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 03:40:49.391047: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 03:40:49.391104: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 03:40:49.391112: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 03:40:49.391707: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Real simutimes: 15000\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 03:40:51.233940: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 03:40:51.234020: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 03:40:51.234029: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 03:40:51.234052: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 03:40:51.235228: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 03:40:51.490294: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 03:40:51.490354: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 03:40:51.490361: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 03:40:51.490366: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 03:40:51.490611: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Time: 36s\n",
      "end\n",
      "\n",
      "Close a tf session!\n",
      "Correlation function of channel noise: \n",
      "[1.         0.5        0.25000003 0.125      0.0625     0.03125\n",
      " 0.015625   0.0078125  0.00390625 0.00195313]\n",
      "2018-06-07 03:41:28.463696: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 03:41:28.463755: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 03:41:28.463767: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 03:41:28.463775: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 03:41:28.464628: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 03:41:29.751793: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 03:41:29.751871: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 03:41:29.751878: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 03:41:29.751885: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 03:41:29.752817: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 03:41:30.160833: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 03:41:30.160911: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 03:41:30.160921: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 03:41:30.160928: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 03:41:30.161210: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: -0.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: -0.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 3.00\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Batch 3 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 5 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 6 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 7 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 8 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 9 in total 47 batches. Practical EbN0: 3.00\n",
      "21600000 bits are simulated!\n",
      "Time: 85s\n",
      "end\n",
      "\n",
      "Close the tf session!\n",
      "Close a tf session!\n",
      "Finished Simulation!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Simulation -CorrPara 0.5 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.5 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Fig. 3(b). Corr:0.5, BP(25)-CNN-BP(25), enhanced, SNR: 0.0~3.0 (Correct!)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to GenData\n",
      "Corr para is set to 0.50\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.50\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: True\n",
      "Normality lambda is set to 10.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[1.         0.5        0.25000003 0.125      0.0625     0.03125\n",
      " 0.015625   0.0078125  0.00390625 0.00195313]\n",
      "2018-06-06 14:51:39.111237: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-06 14:51:39.844657: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-06 14:51:39.844701: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 14:51:40.174161: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 14:51:40.174200: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 14:51:40.174225: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 14:51:40.174730: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-06 14:51:41.447341: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 14:51:41.447460: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 14:51:41.447471: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 14:51:41.447503: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 14:51:41.448752: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-06 14:51:41.467091: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 14:51:41.467119: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 14:51:41.467127: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 14:51:41.467132: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 14:51:41.467408: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 1046s\n",
      "end\n",
      "Close a tf session!\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-06 15:09:08.544554: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:09:08.544629: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:09:08.544656: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:09:08.544662: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:09:08.544904: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-06 15:09:08.577966: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:09:08.578028: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:09:08.578039: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:09:08.578063: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:09:08.578276: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 48s\n",
      "end\n",
      "Close a tf session!\n",
      "Finished GenData!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func GenData -CorrPara 0.5 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.5 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest True -NormLambda 10 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Train\n",
      "Corr para is set to 0.50\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.50\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: True\n",
      "Normality lambda is set to 10.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Construct the data IO class for training!\n",
      "\n",
      "2018-06-06 15:10:02.713776: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-06 15:10:03.376130: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-06 15:10:03.376171: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:10:03.697285: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:10:03.697326: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:10:03.697350: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:10:03.697795: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Test loss: 1.229488, orig loss: 1199.063379\n",
      "Iteration\tLoss\n",
      "500\n",
      "0.3883931408325831\n",
      "1000\n",
      "0.3626318544149399\n",
      "1500\n",
      "0.347648956378301\n",
      "2000\n",
      "0.3415600081284841\n",
      "2500\n",
      "0.33813323477904\n",
      "3000\n",
      "0.33754420777161914\n",
      "3500\n",
      "0.3329964021841685\n",
      "4000\n",
      "0.3346511900424957\n",
      "4500\n",
      "0.33071450094381966\n",
      "5000\n",
      "0.32993575632572175\n",
      "5500\n",
      "0.33003280659516654\n",
      "6000\n",
      "0.3306124111016591\n",
      "6500\n",
      "0.3296646843353907\n",
      "7000\n",
      "0.3290360381205877\n",
      "7500\n",
      "0.3272415518760681\n",
      "8000\n",
      "0.326206178466479\n",
      "8500\n",
      "0.3254195918639501\n",
      "9000\n",
      "0.32883763313293457\n",
      "9500\n",
      "0.32464178701241814\n",
      "10000\n",
      "0.32414356370766956\n",
      "10500\n",
      "0.3241390864054362\n",
      "11000\n",
      "0.32347771326700847\n",
      "11500\n",
      "0.32484788795312247\n",
      "12000\n",
      "0.3260931263367335\n",
      "12500\n",
      "0.32485172947247826\n",
      "13000\n",
      "0.3239896168311437\n",
      "13500\n",
      "0.3229791889588038\n",
      "14000\n",
      "0.323728084564209\n",
      "14500\n",
      "0.32179215749104817\n",
      "15000\n",
      "0.3215353806813558\n",
      "15500\n",
      "0.32238516906897224\n",
      "16000\n",
      "0.3208964943885803\n",
      "16500\n",
      "0.3209579716126124\n",
      "17000\n",
      "0.32546676099300387\n",
      "17500\n",
      "0.32810821930567424\n",
      "18000\n",
      "0.3212593485911687\n",
      "18500\n",
      "0.3206096520026525\n",
      "19000\n",
      "0.32202626168727877\n",
      "19500\n",
      "0.322059221069018\n",
      "20000\n",
      "0.3205392599105835\n",
      "20500\n",
      "0.31982571085294087\n",
      "21000\n",
      "0.31904576818148295\n",
      "21500\n",
      "0.3200708826382955\n",
      "22000\n",
      "0.32046240468819936\n",
      "22500\n",
      "0.3192512522141139\n",
      "23000\n",
      "0.31875044405460357\n",
      "23500\n",
      "0.3209546357393265\n",
      "24000\n",
      "0.3204657902320226\n",
      "24500\n",
      "0.3191984534263611\n",
      "25000\n",
      "0.32105233569939934\n",
      "25500\n",
      "0.32049251794815065\n",
      "26000\n",
      "0.3180447320143382\n",
      "26500\n",
      "0.3186397463083267\n",
      "27000\n",
      "0.31767985224723816\n",
      "27500\n",
      "0.3217886726061503\n",
      "28000\n",
      "0.3177544891834259\n",
      "28500\n",
      "0.3178276737531026\n",
      "29000\n",
      "0.31818514366944634\n",
      "29500\n",
      "0.3203113555908203\n",
      "30000\n",
      "0.31894435385862985\n",
      "30500\n",
      "0.31774698495864867\n",
      "31000\n",
      "0.3179507851600647\n",
      "Save 4 layers.\n",
      "\n",
      "Final minimum loss: 0.317680\n",
      "Used time for training: 930s\n",
      "Delete the data IO class!\n",
      "\n",
      "Finished Train!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Train -CorrPara 0.5 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.5 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest True -NormLambda 10 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Simulation\n",
      "Corr para is set to 0.50\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.50\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: True\n",
      "Normality lambda is set to 10.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[1.         0.5        0.25000003 0.125      0.0625     0.03125\n",
      " 0.015625   0.0078125  0.00390625 0.00195313]\n",
      "2018-06-06 15:25:32.215725: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-06 15:25:32.926474: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-06 15:25:32.926519: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:25:33.231078: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:25:33.231120: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:25:33.231127: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:25:33.231578: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Real simutimes: 15000\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-06 15:25:35.125871: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:25:35.125958: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:25:35.125967: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:25:35.125991: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:25:35.126227: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-06 15:25:35.383516: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:25:35.383601: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:25:35.383627: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:25:35.383633: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:25:35.383856: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Time: 37s\n",
      "end\n",
      "\n",
      "Close a tf session!\n",
      "Correlation function of channel noise: \n",
      "[1.         0.5        0.25000003 0.125      0.0625     0.03125\n",
      " 0.015625   0.0078125  0.00390625 0.00195313]\n",
      "2018-06-06 15:26:13.503566: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:26:13.503628: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:26:13.503645: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:26:13.503681: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:26:13.504011: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-06 15:26:15.199032: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:26:15.199093: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:26:15.199103: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:26:15.199110: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:26:15.199365: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-06 15:26:15.600093: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:26:15.600172: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:26:15.600199: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:26:15.600205: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:26:15.600452: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: -0.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: -0.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 5 in total 47 batches. Practical EbN0: 2.00\n",
      "12960000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 5 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 6 in total 47 batches. Practical EbN0: 2.50\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Batch 7 in total 47 batches. Practical EbN0: 2.51\n",
      "Batch 8 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 9 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 10 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 11 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 12 in total 47 batches. Practical EbN0: 2.49\n",
      "Batch 13 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 14 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 15 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 16 in total 47 batches. Practical EbN0: 2.51\n",
      "Batch 17 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 18 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 19 in total 47 batches. Practical EbN0: 2.51\n",
      "Batch 20 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 21 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 22 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 23 in total 47 batches. Practical EbN0: 2.51\n",
      "Batch 24 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 25 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 26 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 27 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 28 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 29 in total 47 batches. Practical EbN0: 2.49\n",
      "Batch 30 in total 47 batches. Practical EbN0: 2.51\n",
      "Batch 31 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 32 in total 47 batches. Practical EbN0: 2.49\n",
      "Batch 33 in total 47 batches. Practical EbN0: 2.49\n",
      "Batch 34 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 35 in total 47 batches. Practical EbN0: 2.49\n",
      "Batch 36 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 37 in total 47 batches. Practical EbN0: 2.51\n",
      "Batch 38 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 39 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 40 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 41 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 42 in total 47 batches. Practical EbN0: 2.49\n",
      "Batch 43 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 44 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 45 in total 47 batches. Practical EbN0: 2.51\n",
      "Batch 46 in total 47 batches. Practical EbN0: 2.50\n",
      "101520000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 5 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 6 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 7 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 8 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 9 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 10 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 11 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 12 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 13 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 14 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 15 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 16 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 17 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 18 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 19 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 20 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 21 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 22 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 23 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 24 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 25 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 26 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 27 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 28 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 29 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 30 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 31 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 32 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 33 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 34 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 35 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 36 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 37 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 38 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 39 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 40 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 41 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 42 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 43 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 44 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 45 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 46 in total 47 batches. Practical EbN0: 3.00\n",
      "101520000 bits are simulated!\n",
      "Time: 257s\n",
      "end\n",
      "\n",
      "Close the tf session!\n",
      "Close a tf session!\n",
      "Finished Simulation!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Simulation -CorrPara 0.5 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.5 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest True -NormLambda 10 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Fig. 3(b). Corr:0.5, BP(50), SNR: 0.0~3.0 (Different.)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to GenData\n",
      "Corr para is set to 0.50\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.50\n",
      "BP iter for gen data is set to: [50]\n",
      "BP iter for simulation is set to: [50]\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[1.         0.5        0.25000003 0.125      0.0625     0.03125\n",
      " 0.015625   0.0078125  0.00390625 0.00195313]\n",
      "2018-06-06 15:30:35.813277: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-06 15:30:36.516992: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-06 15:30:36.517029: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:30:36.812092: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:30:36.812133: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:30:36.812158: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:30:36.812701: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-06 15:30:38.152411: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:30:38.152484: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:30:38.152495: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:30:38.152532: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:30:38.152860: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-06 15:30:38.170823: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:30:38.170849: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:30:38.170856: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:30:38.170861: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:30:38.171058: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 1341s\n",
      "end\n",
      "Close a tf session!\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-06 15:53:00.765142: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:53:00.765216: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:53:00.765243: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:53:00.765249: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:53:00.765508: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-06 15:53:00.797951: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:53:00.798001: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:53:00.798009: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:53:00.798014: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:53:00.798270: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 55s\n",
      "end\n",
      "Close a tf session!\n",
      "Finished GenData!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func GenData -CorrPara 0.5 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.5 -BP_IterForGenData 50 -BP_IterForSimu \"50\" -NetNumber 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Train\n",
      "Corr para is set to 0.50\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.50\n",
      "BP iter for gen data is set to: [50]\n",
      "BP iter for simulation is set to: [50]\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Construct the data IO class for training!\n",
      "\n",
      "2018-06-06 15:54:01.292731: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-06 15:54:01.918191: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-06 15:54:01.918251: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:54:02.215201: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:54:02.215238: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:54:02.215262: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:54:02.215708: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Test loss: 3.016544, orig loss: 47.882759\n",
      "Iteration\tLoss\n",
      "500\n",
      "0.21244403223196665\n",
      "1000\n",
      "0.2036638562877973\n",
      "1500\n",
      "0.2018891637523969\n",
      "2000\n",
      "0.2002889116605123\n",
      "2500\n",
      "0.19953601161638895\n",
      "3000\n",
      "0.1986660862962405\n",
      "3500\n",
      "0.198714875181516\n",
      "4000\n",
      "0.19782717178265255\n",
      "4500\n",
      "0.19694262941678364\n",
      "5000\n",
      "0.19673784325520197\n",
      "^C\n",
      "Traceback (most recent call last):\n",
      "  File \"main.py\", line 42, in <module>\n",
      "    conv_net.train_network(top_config.model_id)\n",
      "  File \"/workspace/BPCNN/ConvNet.py\", line 209, in train_network\n",
      "    sess.run([train_step], feed_dict={x_in: batch_xs, y_label: batch_ys})\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 900, in run\n",
      "    run_metadata_ptr)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1135, in _run\n",
      "    feed_dict_tensor, options, run_metadata)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1316, in _do_run\n",
      "    run_metadata)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1322, in _do_call\n",
      "    return fn(*args)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1307, in _run_fn\n",
      "    options, feed_dict, fetch_list, target_list, run_metadata)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1409, in _call_tf_sessionrun\n",
      "    run_metadata)\n",
      "KeyboardInterrupt\n",
      "Delete the data IO class!\n",
      "\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Train -CorrPara 0.5 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.5 -BP_IterForGenData 50 -BP_IterForSimu \"50\" -NetNumber 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Simulation\n",
      "Corr para is set to 0.50\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.50\n",
      "BP iter for gen data is set to: [50]\n",
      "BP iter for simulation is set to: [50]\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[1.         0.5        0.25000003 0.125      0.0625     0.03125\n",
      " 0.015625   0.0078125  0.00390625 0.00195313]\n",
      "2018-06-06 15:57:02.911406: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-06 15:57:03.667906: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-06 15:57:03.667946: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:57:03.972540: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:57:03.972579: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:57:03.972593: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:57:03.973028: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Real simutimes: 15000\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-06 15:57:05.896277: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:57:05.896360: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:57:05.896388: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:57:05.896394: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:57:05.896728: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-06 15:57:06.179735: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:57:06.179795: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:57:06.179804: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:57:06.179810: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:57:06.180044: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Time: 47s\n",
      "end\n",
      "\n",
      "Close a tf session!\n",
      "Correlation function of channel noise: \n",
      "[1.         0.5        0.25000003 0.125      0.0625     0.03125\n",
      " 0.015625   0.0078125  0.00390625 0.00195313]\n",
      "2018-06-06 15:57:53.699594: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:57:53.699651: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:57:53.699670: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:57:53.699682: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:57:53.699988: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-06 15:57:54.978124: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:57:54.978186: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:57:54.978197: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:57:54.978203: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:57:54.978468: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-06 15:57:55.338970: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-06 15:57:55.339045: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-06 15:57:55.339056: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-06 15:57:55.339080: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-06 15:57:55.339349: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: -0.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: -0.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 5 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 6 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 7 in total 47 batches. Practical EbN0: 2.51\n",
      "Batch 8 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 9 in total 47 batches. Practical EbN0: 2.50\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "21600000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 5 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 6 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 7 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 8 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 9 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 10 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 11 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 12 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 13 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 14 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 15 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 16 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 17 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 18 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 19 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 20 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 21 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 22 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 23 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 24 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 25 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 26 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 27 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 28 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 29 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 30 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 31 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 32 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 33 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 34 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 35 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 36 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 37 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 38 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 39 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 40 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 41 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 42 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 43 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 44 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 45 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 46 in total 47 batches. Practical EbN0: 3.00\n",
      "101520000 bits are simulated!\n",
      "Time: 170s\n",
      "end\n",
      "\n",
      "Close the tf session!\n",
      "Close a tf session!\n",
      "Finished Simulation!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Simulation -CorrPara 0.5 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.5 -BP_IterForGenData 50 -BP_IterForSimu \"50\" -NetNumber 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Fig. 3(c). Corr:0.0, BP(25)-CNN-BP(25), baseline, SNR: 0.0~3.0 (Correct!)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Function is set to GenData\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-21 05:13:30.506281: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-21 05:13:35.548312: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 4.45GiB\n",
      "2018-06-21 05:13:35.548383: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-21 05:13:36.974618: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-21 05:13:36.974647: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-21 05:13:36.974673: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-21 05:13:36.975008: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4182 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-21 05:13:40.114348: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-21 05:13:40.114436: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-21 05:13:40.114544: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-21 05:13:40.114632: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-21 05:13:40.114909: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4182 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-21 05:13:40.309313: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-21 05:13:40.309426: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-21 05:13:40.309439: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-21 05:13:40.309447: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-21 05:13:40.309711: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4182 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func GenData -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!python main.py -Func Train -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!python main.py -Func Simulation -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Fig. 3(c). Corr:0.0, BP(25)-CNN-BP(25), enhanced, SNR: 0.0~3.0 (Correct!)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to GenData\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: True\n",
      "Normality lambda is set to 10.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-07 08:28:13.205713: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 08:28:13.904735: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 08:28:13.904782: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 08:28:14.194171: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 08:28:14.194209: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 08:28:14.194234: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 08:28:14.194719: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 08:28:15.666545: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 08:28:15.666626: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 08:28:15.666638: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 08:28:15.666661: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 08:28:15.667520: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 08:28:15.686594: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 08:28:15.686643: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 08:28:15.686671: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 08:28:15.686694: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 08:28:15.687270: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 1003s\n",
      "end\n",
      "Close a tf session!\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 08:45:00.479312: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 08:45:00.479373: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 08:45:00.479383: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 08:45:00.479390: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 08:45:00.480143: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 08:45:00.511200: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 08:45:00.511235: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 08:45:00.511243: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 08:45:00.511248: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 08:45:00.511469: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 43s\n",
      "end\n",
      "Close a tf session!\n",
      "Finished GenData!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func GenData -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest True -NormLambda 10 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Train\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: True\n",
      "Normality lambda is set to 10.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Construct the data IO class for training!\n",
      "\n",
      "2018-06-07 08:45:48.555333: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 08:45:49.176914: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 08:45:49.176953: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 08:45:49.469543: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 08:45:49.469581: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 08:45:49.469589: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 08:45:49.470059: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Test loss: 0.668240, orig loss: 1141.670101\n",
      "Iteration\tLoss\n",
      "500\n",
      "0.4468294709920883\n",
      "1000\n",
      "0.4292070060968399\n",
      "1500\n",
      "0.4262867271900177\n",
      "2000\n",
      "0.4245469093322754\n",
      "2500\n",
      "0.4231283018986384\n",
      "3000\n",
      "0.42188771863778435\n",
      "3500\n",
      "0.4203210840622584\n",
      "4000\n",
      "0.41948481400807697\n",
      "4500\n",
      "0.41911852757136026\n",
      "5000\n",
      "0.41928933064142865\n",
      "5500\n",
      "0.41819786628087363\n",
      "6000\n",
      "0.42380146284898124\n",
      "6500\n",
      "0.41752681533495584\n",
      "7000\n",
      "0.41728269855181377\n",
      "7500\n",
      "0.41676428616046907\n",
      "8000\n",
      "0.4166017343600591\n",
      "8500\n",
      "0.4166193723678589\n",
      "9000\n",
      "0.4161664585272471\n",
      "9500\n",
      "0.41692047119140624\n",
      "10000\n",
      "0.4155923694372177\n",
      "10500\n",
      "0.4160526672999064\n",
      "11000\n",
      "0.41683753033479054\n",
      "11500\n",
      "0.41584891776243843\n",
      "12000\n",
      "0.41855727036794027\n",
      "12500\n",
      "0.4160413225491842\n",
      "13000\n",
      "0.41515698631604514\n",
      "13500\n",
      "0.4154849499464035\n",
      "14000\n",
      "0.4209368666013082\n",
      "14500\n",
      "0.41419951717058817\n",
      "15000\n",
      "0.4138388097286224\n",
      "15500\n",
      "0.4148315419753393\n",
      "16000\n",
      "0.41459067165851593\n",
      "16500\n",
      "0.4135680059591929\n",
      "17000\n",
      "0.41439767678578693\n",
      "17500\n",
      "0.4135815680027008\n",
      "18000\n",
      "0.41415370206038155\n",
      "18500\n",
      "0.4136805087327957\n",
      "19000\n",
      "0.4136268854141235\n",
      "19500\n",
      "0.4133796284596125\n",
      "20000\n",
      "0.4130169947942098\n",
      "20500\n",
      "0.4131057451168696\n",
      "21000\n",
      "0.41301200687885287\n",
      "21500\n",
      "0.414914608001709\n",
      "22000\n",
      "0.4127211093902588\n",
      "22500\n",
      "0.4163139303525289\n",
      "23000\n",
      "0.4137623945871989\n",
      "23500\n",
      "0.4120649963617325\n",
      "24000\n",
      "0.4136344989140828\n",
      "24500\n",
      "0.41413329939047494\n",
      "25000\n",
      "0.41224888563156126\n",
      "25500\n",
      "0.4118451605240504\n",
      "26000\n",
      "0.41194806098937986\n",
      "26500\n",
      "0.41241084337234496\n",
      "27000\n",
      "0.4147943049669266\n",
      "27500\n",
      "0.4128757039705912\n",
      "28000\n",
      "0.41199332773685454\n",
      "28500\n",
      "0.4118597060441971\n",
      "29000\n",
      "0.41277563373247783\n",
      "29500\n",
      "0.411326003074646\n",
      "30000\n",
      "0.41117646992206575\n",
      "30500\n",
      "0.41180903017520903\n",
      "31000\n",
      "0.4109935492277145\n",
      "31500\n",
      "0.4129049946864446\n",
      "32000\n",
      "0.4114140580097834\n",
      "32500\n",
      "0.41139589647452035\n",
      "33000\n",
      "0.4113242377837499\n",
      "33500\n",
      "0.4124721239010493\n",
      "34000\n",
      "0.41164386669794717\n",
      "34500\n",
      "0.41375270386536916\n",
      "35000\n",
      "0.41548586189746856\n",
      "Save 4 layers.\n",
      "\n",
      "Final minimum loss: 0.410994\n",
      "Used time for training: 1032s\n",
      "Delete the data IO class!\n",
      "\n",
      "Finished Train!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Train -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest True -NormLambda 10 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Simulation\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: True\n",
      "Normality lambda is set to 10.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-07 09:03:00.329462: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 09:03:01.102359: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 09:03:01.102398: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:03:01.413336: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:03:01.413377: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:03:01.413403: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:03:01.413976: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Real simutimes: 15000\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 09:03:03.285575: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:03:03.285636: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:03:03.285645: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:03:03.285653: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:03:03.285906: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 09:03:03.555166: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:03:03.555225: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:03:03.555255: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:03:03.555262: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:03:03.555601: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Time: 38s\n",
      "end\n",
      "\n",
      "Close a tf session!\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-07 09:03:42.140055: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:03:42.140117: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:03:42.140138: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:03:42.140155: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:03:42.140444: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 09:03:43.543029: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:03:43.543124: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:03:43.543135: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:03:43.543141: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:03:43.543406: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 09:03:44.000398: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:03:44.000474: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:03:44.000503: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:03:44.000510: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:03:44.000730: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 5 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 6 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 7 in total 47 batches. Practical EbN0: 2.51\n",
      "Batch 8 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 9 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 10 in total 47 batches. Practical EbN0: 2.50\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Batch 11 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 12 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 13 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 14 in total 47 batches. Practical EbN0: 2.50\n",
      "32400000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 5 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 6 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 7 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 8 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 9 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 10 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 11 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 12 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 13 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 14 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 15 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 16 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 17 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 18 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 19 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 20 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 21 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 22 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 23 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 24 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 25 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 26 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 27 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 28 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 29 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 30 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 31 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 32 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 33 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 34 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 35 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 36 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 37 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 38 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 39 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 40 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 41 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 42 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 43 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 44 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 45 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 46 in total 47 batches. Practical EbN0: 3.00\n",
      "101520000 bits are simulated!\n",
      "Time: 182s\n",
      "end\n",
      "\n",
      "Close the tf session!\n",
      "Close a tf session!\n",
      "Finished Simulation!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Simulation -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest True -NormLambda 10 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Fig. 3(c). Corr:0.0, BP(50), SNR: 0.0~3.0 (Correct!)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to GenData\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [50]\n",
      "BP iter for simulation is set to: [50]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-07 09:06:49.310362: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 09:06:49.996750: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 09:06:49.996790: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:06:50.310830: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:06:50.310868: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:06:50.310903: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:06:50.311430: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 09:06:51.574605: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:06:51.574687: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:06:51.574713: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:06:51.574720: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:06:51.575024: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 09:06:51.593045: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:06:51.593082: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:06:51.593109: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:06:51.593115: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:06:51.594536: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 1371s\n",
      "end\n",
      "Close a tf session!\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 09:29:44.570166: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:29:44.570228: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:29:44.570237: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:29:44.570243: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:29:44.570517: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 09:29:44.601599: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:29:44.601650: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:29:44.601661: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:29:44.601667: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:29:44.601916: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 54s\n",
      "end\n",
      "Close a tf session!\n",
      "Finished GenData!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func GenData -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 50 -BP_IterForSimu \"50\" -NetNumber 0 -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Train\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [50]\n",
      "BP iter for simulation is set to: [50]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Construct the data IO class for training!\n",
      "\n",
      "2018-06-07 09:30:43.046322: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 09:30:43.677004: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 09:30:43.677066: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:30:43.969772: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:30:43.969811: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:30:43.969836: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:30:43.970292: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Test loss: 0.765973, orig loss: 0.085776\n",
      "Iteration\tLoss\n",
      "500\n",
      "0.08305235877633095\n",
      "1000\n",
      "0.08254825646678607\n",
      "1500\n",
      "0.08232665583491325\n",
      "2000\n",
      "0.0822283628086249\n",
      "2500\n",
      "0.08218391140302023\n",
      "3000\n",
      "0.08211674789587657\n",
      "3500\n",
      "0.08210418572028479\n",
      "4000\n",
      "0.08210434342424075\n",
      "4500\n",
      "0.08205256586273511\n",
      "5000\n",
      "0.08205651740233104\n",
      "5500\n",
      "0.0820357233285904\n",
      "6000\n",
      "0.08200404817859332\n",
      "6500\n",
      "0.08198729107777278\n",
      "7000\n",
      "0.08202970549464225\n",
      "7500\n",
      "0.08196076030532519\n",
      "8000\n",
      "0.08193951547145843\n",
      "8500\n",
      "0.08192780067523321\n",
      "9000\n",
      "0.08191524942715962\n",
      "9500\n",
      "0.08191035290559133\n",
      "10000\n",
      "0.0819045106569926\n",
      "10500\n",
      "0.08188865557312966\n",
      "11000\n",
      "0.08191649715105692\n",
      "11500\n",
      "0.08190351178248724\n",
      "12000\n",
      "0.08192806815107663\n",
      "12500\n",
      "0.08189383819699288\n",
      "13000\n",
      "0.08189207166433335\n",
      "13500\n",
      "0.08189569140474001\n",
      "14000\n",
      "0.08186345497767131\n",
      "14500\n",
      "0.08190308933456739\n",
      "15000\n",
      "0.08189568469921747\n",
      "15500\n",
      "0.08186089619994164\n",
      "16000\n",
      "0.08187247688571613\n",
      "16500\n",
      "0.08191411023338636\n",
      "17000\n",
      "0.08186391840378443\n",
      "17500\n",
      "0.08187129547198614\n",
      "18000\n",
      "0.08187186618645986\n",
      "18500\n",
      "0.0818948763112227\n",
      "19000\n",
      "0.08185602650046349\n",
      "19500\n",
      "0.08185390755534172\n",
      "20000\n",
      "0.08184740046660105\n",
      "20500\n",
      "0.08190535207589468\n",
      "21000\n",
      "0.08184875970085462\n",
      "21500\n",
      "0.0818554679552714\n",
      "22000\n",
      "0.08185125465194384\n",
      "22500\n",
      "0.08184723978241285\n",
      "23000\n",
      "0.08187053302923838\n",
      "23500\n",
      "0.08186928853392601\n",
      "24000\n",
      "0.08184485087792079\n",
      "24500\n",
      "0.08183864454428355\n",
      "25000\n",
      "0.08184915433327357\n",
      "25500\n",
      "0.08187722911437352\n",
      "26000\n",
      "0.08188898911078771\n",
      "26500\n",
      "0.08183769409855207\n",
      "27000\n",
      "0.0818398470679919\n",
      "27500\n",
      "0.08184359868367513\n",
      "28000\n",
      "0.08183909133076668\n",
      "28500\n",
      "0.08184387038151424\n",
      "29000\n",
      "0.08185720965266227\n",
      "29500\n",
      "0.08183577929933866\n",
      "30000\n",
      "0.08183503026763599\n",
      "30500\n",
      "0.0818594532708327\n",
      "31000\n",
      "0.08183208877841631\n",
      "31500\n",
      "0.08183332209785779\n",
      "32000\n",
      "0.08195323944091797\n",
      "32500\n",
      "0.08183836812774341\n",
      "33000\n",
      "0.08183278813958168\n",
      "33500\n",
      "0.08183339337507883\n",
      "34000\n",
      "0.08183265353242557\n",
      "34500\n",
      "0.08183174456159274\n",
      "35000\n",
      "0.08184399604797363\n",
      "35500\n",
      "0.08184450988968213\n",
      "36000\n",
      "0.08182924464344979\n",
      "36500\n",
      "0.08187083477775256\n",
      "37000\n",
      "0.0818465642631054\n",
      "37500\n",
      "0.08183369934558868\n",
      "38000\n",
      "0.08183503523468971\n",
      "38500\n",
      "0.08183049783110619\n",
      "39000\n",
      "0.08183901061614354\n",
      "39500\n",
      "0.081836865345637\n",
      "40000\n",
      "0.08183211361368498\n",
      "Save 4 layers.\n",
      "\n",
      "Final minimum loss: 0.081829\n",
      "Used time for training: 1098s\n",
      "Delete the data IO class!\n",
      "\n",
      "Finished Train!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Train -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 50 -BP_IterForSimu \"50\" -NetNumber 0 -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Simulation\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [50]\n",
      "BP iter for simulation is set to: [50]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-07 09:49:01.315046: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 09:49:01.999912: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 09:49:01.999967: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:49:02.280200: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:49:02.280242: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:49:02.280266: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:49:02.280852: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Real simutimes: 15000\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 09:49:03.993424: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:49:03.993481: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:49:03.993491: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:49:03.993526: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:49:03.993790: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 09:49:04.252078: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:49:04.252129: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:49:04.252137: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:49:04.252142: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:49:04.252385: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Time: 45s\n",
      "end\n",
      "\n",
      "Close a tf session!\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-07 09:49:50.401246: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:49:50.401298: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:49:50.401314: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:49:50.401346: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:49:50.402515: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 09:49:51.639086: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:49:51.639148: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:49:51.639155: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:49:51.639161: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:49:51.639425: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 09:49:51.970070: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 09:49:51.970157: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 09:49:51.970166: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 09:49:51.970190: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 09:49:51.970477: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 5 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 6 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 7 in total 47 batches. Practical EbN0: 2.51\n",
      "Batch 8 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 9 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 10 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 11 in total 47 batches. Practical EbN0: 2.50\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Batch 12 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 13 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 14 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 15 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 16 in total 47 batches. Practical EbN0: 2.50\n",
      "36720000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 5 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 6 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 7 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 8 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 9 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 10 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 11 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 12 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 13 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 14 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 15 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 16 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 17 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 18 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 19 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 20 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 21 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 22 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 23 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 24 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 25 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 26 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 27 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 28 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 29 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 30 in total 47 batches. Practical EbN0: 3.01\n",
      "Batch 31 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 32 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 33 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 34 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 35 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 36 in total 47 batches. Practical EbN0: 2.99\n",
      "Batch 37 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 38 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 39 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 40 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 41 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 42 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 43 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 44 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 45 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 46 in total 47 batches. Practical EbN0: 3.00\n",
      "101520000 bits are simulated!\n",
      "Time: 179s\n",
      "end\n",
      "\n",
      "Close the tf session!\n",
      "Close a tf session!\n",
      "Finished Simulation!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Simulation -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 50 -BP_IterForSimu \"50\" -NetNumber 0 -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### URLLC. Corr:0.0, BP(25)-CNN-BP(25), baseline, SNR: 0.0~3.0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to GenData\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "URLLC Interference: True\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-07 15:45:14.007301: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 15:45:14.714257: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 15:45:14.714299: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 15:45:15.051652: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 15:45:15.051700: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 15:45:15.051725: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 15:45:15.052269: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 15:45:16.449970: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 15:45:16.450051: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 15:45:16.450060: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 15:45:16.450084: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 15:45:16.450486: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 15:45:16.470610: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 15:45:16.470662: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 15:45:16.470672: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 15:45:16.470678: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 15:45:16.470872: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 1061s\n",
      "end\n",
      "Close a tf session!\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 16:02:59.261942: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:02:59.262023: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:02:59.262050: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:02:59.262074: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:02:59.262302: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 16:02:59.291561: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:02:59.291607: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:02:59.291633: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:02:59.291640: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:02:59.291943: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 47s\n",
      "end\n",
      "Close a tf session!\n",
      "Finished GenData!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func GenData -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\" -URLLC_Intf True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Train\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "URLLC Interference: True\n",
      "Construct the data IO class for training!\n",
      "\n",
      "2018-06-07 16:03:51.345845: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 16:03:51.991247: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 16:03:51.991309: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:03:52.298090: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:03:52.298130: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:03:52.298137: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:03:52.298647: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Test loss: 1.739503, orig loss: 0.576565\n",
      "Iteration\tLoss\n",
      "500\n",
      "0.2973142981529236\n",
      "1000\n",
      "0.2960624833901723\n",
      "1500\n",
      "0.2957566618919373\n",
      "2000\n",
      "0.29556129276752474\n",
      "2500\n",
      "0.2954241712888082\n",
      "3000\n",
      "0.29530419905980426\n",
      "3500\n",
      "0.29536387423674265\n",
      "4000\n",
      "0.29521119395891826\n",
      "4500\n",
      "0.2951626678307851\n",
      "5000\n",
      "0.29514461060365044\n",
      "5500\n",
      "0.29509251515070595\n",
      "6000\n",
      "0.2951878915230433\n",
      "6500\n",
      "0.29522281686464946\n",
      "7000\n",
      "0.2950121134519577\n",
      "7500\n",
      "0.29500341415405273\n",
      "8000\n",
      "0.2949957032998403\n",
      "8500\n",
      "0.29499408006668093\n",
      "9000\n",
      "0.2949387530485789\n",
      "9500\n",
      "0.29492429792881014\n",
      "10000\n",
      "0.2948896368344625\n",
      "10500\n",
      "0.2948865244785945\n",
      "11000\n",
      "0.2948760658502579\n",
      "11500\n",
      "0.29484139482180277\n",
      "12000\n",
      "0.2948224127292633\n",
      "12500\n",
      "0.294816596309344\n",
      "13000\n",
      "0.29482322235902153\n",
      "13500\n",
      "0.2948049038648605\n",
      "14000\n",
      "0.2948282569646835\n",
      "14500\n",
      "0.29478870034217836\n",
      "15000\n",
      "0.2947864274183909\n",
      "15500\n",
      "0.29489070375760396\n",
      "16000\n",
      "0.29479241371154785\n",
      "16500\n",
      "0.29478181501229606\n",
      "17000\n",
      "0.29479699234167733\n",
      "17500\n",
      "0.29480513334274294\n",
      "18000\n",
      "0.2948268791039785\n",
      "18500\n",
      "0.29481909473737083\n",
      "19000\n",
      "0.29481084644794464\n",
      "19500\n",
      "0.29476654827594756\n",
      "20000\n",
      "0.29478775362173715\n",
      "20500\n",
      "0.2947705199321111\n",
      "21000\n",
      "0.2947681486606598\n",
      "21500\n",
      "0.2947462826967239\n",
      "22000\n",
      "0.29474069277445475\n",
      "22500\n",
      "0.29481721818447115\n",
      "23000\n",
      "0.2947774400313695\n",
      "23500\n",
      "0.2947408805290858\n",
      "24000\n",
      "0.2947284917036692\n",
      "24500\n",
      "0.2947502672672272\n",
      "25000\n",
      "0.29472016990184785\n",
      "25500\n",
      "0.29472407897313435\n",
      "26000\n",
      "0.2947151114543279\n",
      "26500\n",
      "0.2947200357913971\n",
      "27000\n",
      "0.2947081714868546\n",
      "27500\n",
      "0.2948197176059087\n",
      "28000\n",
      "0.29470216830571494\n",
      "28500\n",
      "0.2946977605422338\n",
      "29000\n",
      "0.2947822044293086\n",
      "29500\n",
      "0.29471042156219485\n",
      "30000\n",
      "0.2947100689013799\n",
      "30500\n",
      "0.2947203407684962\n",
      "31000\n",
      "0.2946915656328201\n",
      "31500\n",
      "0.29470795889695484\n",
      "32000\n",
      "0.29469132522741953\n",
      "32500\n",
      "0.2946826050678889\n",
      "33000\n",
      "0.29471041162808737\n",
      "33500\n",
      "0.2946825424830119\n",
      "34000\n",
      "0.2946975777546565\n",
      "34500\n",
      "0.29468806385993956\n",
      "35000\n",
      "0.29469075202941897\n",
      "35500\n",
      "0.29469519754250845\n",
      "36000\n",
      "0.2946859250466029\n",
      "36500\n",
      "0.29468734165032706\n",
      "37000\n",
      "0.2946762810150782\n",
      "37500\n",
      "0.29469043513139087\n",
      "38000\n",
      "0.2946782986323039\n",
      "38500\n",
      "0.29468391338984173\n",
      "39000\n",
      "0.29467880924542744\n",
      "39500\n",
      "0.29469111263751985\n",
      "40000\n",
      "0.29468307793140414\n",
      "40500\n",
      "0.29468370278676354\n",
      "41000\n",
      "0.29473755359649656\n",
      "Save 4 layers.\n",
      "\n",
      "Final minimum loss: 0.294676\n",
      "Used time for training: 1169s\n",
      "Delete the data IO class!\n",
      "\n",
      "Finished Train!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Train -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\" -URLLC_Intf True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Simulation\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "URLLC Interference: True\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-07 16:23:21.145710: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 16:23:21.901184: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 16:23:21.901270: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:23:22.204409: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:23:22.204466: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:23:22.204474: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:23:22.205990: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Real simutimes: 15000\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 16:23:24.205691: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:23:24.205818: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:23:24.205831: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:23:24.205838: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:23:24.206164: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 16:23:24.494676: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:23:24.494757: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:23:24.494785: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:23:24.494791: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:23:24.495072: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Time: 43s\n",
      "end\n",
      "\n",
      "Close a tf session!\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-07 16:24:08.103721: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:24:08.103776: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:24:08.103788: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:24:08.103802: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:24:08.104042: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 16:24:09.741414: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:24:09.741481: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:24:09.741492: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:24:09.741498: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:24:09.742629: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 16:24:10.142415: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:24:10.142493: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:24:10.142519: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:24:10.142542: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:24:10.142750: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: -0.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 3.00\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10800000 bits are simulated!\r\n",
      "Time: 84s\r\n",
      "end\r\n",
      "\r\n",
      "Close the tf session!\r\n",
      "Close a tf session!\r\n",
      "Finished Simulation!\r\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Simulation -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\" -URLLC_Intf True"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### URLLC. Corr:0.0, BP(25), SNR: 0.0~3.0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to GenData\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "URLLC Interference: True\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-07 16:25:37.075868: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 16:25:37.799703: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 16:25:37.799747: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:25:38.110724: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:25:38.110765: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:25:38.110773: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:25:38.112093: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 16:25:39.370557: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:25:39.370647: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:25:39.370677: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:25:39.370684: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:25:39.370911: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 16:25:39.388285: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:25:39.388329: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:25:39.388339: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:25:39.388345: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:25:39.388607: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 1066s\n",
      "end\n",
      "Close a tf session!\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 16:43:27.070172: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:43:27.070254: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:43:27.070264: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:43:27.070288: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:43:27.070989: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 16:43:27.102555: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:43:27.102612: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:43:27.102623: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:43:27.102647: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:43:27.102913: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Time: 47s\n",
      "end\n",
      "Close a tf session!\n",
      "Finished GenData!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func GenData -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25\" -NetNumber 0 -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\" -URLLC_Intf True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Train\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "URLLC Interference: True\n",
      "Construct the data IO class for training!\n",
      "\n",
      "2018-06-07 16:44:19.460262: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 16:44:20.104662: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 16:44:20.104712: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:44:20.432433: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:44:20.432474: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:44:20.432481: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:44:20.434107: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Test loss: 1.605866, orig loss: 0.576675\n",
      "Iteration\tLoss\n",
      "500\n",
      "0.2987755904595057\n",
      "1000\n",
      "0.2968834082285563\n",
      "1500\n",
      "0.2959301918745041\n",
      "2000\n",
      "0.29571805795033773\n",
      "2500\n",
      "0.29551469882329306\n",
      "3000\n",
      "0.29541641275087993\n",
      "3500\n",
      "0.295329741636912\n",
      "4000\n",
      "0.29515998661518095\n",
      "4500\n",
      "0.29508285025755565\n",
      "5000\n",
      "0.29502976934115094\n",
      "5500\n",
      "0.2951587309439977\n",
      "6000\n",
      "0.2949416438738505\n",
      "6500\n",
      "0.29494439363479613\n",
      "7000\n",
      "0.29496126671632134\n",
      "7500\n",
      "0.29484758377075193\n",
      "8000\n",
      "0.2948506325483322\n",
      "8500\n",
      "0.29483040372530617\n",
      "9000\n",
      "0.29486182034015657\n",
      "9500\n",
      "0.29482126235961914\n",
      "10000\n",
      "0.29480776488780974\n",
      "10500\n",
      "0.29476580818494164\n",
      "11000\n",
      "0.29476417005062105\n",
      "11500\n",
      "0.2947727729876836\n",
      "12000\n",
      "0.2947583814462026\n",
      "12500\n",
      "0.2947625398635864\n",
      "13000\n",
      "0.29474813838799796\n",
      "13500\n",
      "0.2947754094998042\n",
      "14000\n",
      "0.29473513960838316\n",
      "14500\n",
      "0.2947459101676941\n",
      "15000\n",
      "0.2947335203488668\n",
      "15500\n",
      "0.29475200871626533\n",
      "16000\n",
      "0.2947589596112569\n",
      "16500\n",
      "0.2947410821914673\n",
      "17000\n",
      "0.2947134017944336\n",
      "17500\n",
      "0.2947050760189692\n",
      "18000\n",
      "0.29475390513738\n",
      "18500\n",
      "0.2950084775686264\n",
      "19000\n",
      "0.2947216540575027\n",
      "19500\n",
      "0.2947043667236964\n",
      "20000\n",
      "0.29471853574117024\n",
      "20500\n",
      "0.2946803589661916\n",
      "21000\n",
      "0.2947186827659607\n",
      "21500\n",
      "0.2946782539288203\n",
      "22000\n",
      "0.2946907848119736\n",
      "22500\n",
      "0.29474484622478486\n",
      "23000\n",
      "0.2946893592675527\n",
      "23500\n",
      "0.29473962883154553\n",
      "24000\n",
      "0.29470144112904867\n",
      "24500\n",
      "0.294704732298851\n",
      "25000\n",
      "0.29467798173427584\n",
      "25500\n",
      "0.2946700265010198\n",
      "26000\n",
      "0.2947588582833608\n",
      "26500\n",
      "0.29465983211994173\n",
      "27000\n",
      "0.2946620583534241\n",
      "27500\n",
      "0.29465625683466595\n",
      "28000\n",
      "0.2946600764989853\n",
      "28500\n",
      "0.2946726123491923\n",
      "29000\n",
      "0.2946582605441411\n",
      "29500\n",
      "0.29468093514442445\n",
      "30000\n",
      "0.2947064131498337\n",
      "30500\n",
      "0.29471136927604674\n",
      "31000\n",
      "0.2946721613407135\n",
      "31500\n",
      "0.2946688493092855\n",
      "Save 4 layers.\n",
      "\n",
      "Final minimum loss: 0.294656\n",
      "Used time for training: 894s\n",
      "Delete the data IO class!\n",
      "\n",
      "Finished Train!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Train -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25\" -NetNumber 0 -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\" -URLLC_Intf True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Function is set to Simulation\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "URLLC Interference: True\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-07 16:59:13.308144: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-07 16:59:14.029830: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 15.36GiB\n",
      "2018-06-07 16:59:14.029876: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:59:14.323418: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:59:14.323544: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:59:14.323583: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:59:14.324115: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Real simutimes: 15000\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 16:59:15.915200: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:59:15.915259: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:59:15.915267: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:59:15.915275: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:59:15.915554: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 16:59:16.193148: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:59:16.193227: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:59:16.193236: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:59:16.193260: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:59:16.193555: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Restore the first 4 layers.\n",
      "\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Batch id: 0\n",
      "Batch id: 1\n",
      "Batch id: 2\n",
      "Time: 41s\n",
      "end\n",
      "\n",
      "Close a tf session!\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-07 16:59:57.906602: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:59:57.906675: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:59:57.906694: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:59:57.906711: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:59:57.907024: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-07 16:59:59.426935: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:59:59.427000: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:59:59.427010: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:59:59.427016: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:59:59.427278: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-07 16:59:59.762865: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-07 16:59:59.762927: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-07 16:59:59.762935: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-07 16:59:59.762942: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-07 16:59:59.763222: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14867 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: -0.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 0.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 0.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 1.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 1.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.00\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 1 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 2 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 3 in total 47 batches. Practical EbN0: 2.50\n",
      "Batch 4 in total 47 batches. Practical EbN0: 2.50\n",
      "10800000 bits are simulated!\n",
      "Batch 0 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 1 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 2 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 3 in total 47 batches. Practical EbN0: 3.00\n",
      "Batch 4 in total 47 batches. Practical EbN0: 3.00\n",
      "10800000 bits are simulated!\n",
      "Time: 61s\n",
      "end\n",
      "\n",
      "Close the tf session!\n",
      "Close a tf session!\n",
      "Finished Simulation!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Simulation -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25\" -NetNumber 0 -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\" -URLLC_Intf True"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### URLLC. Corr:0.0, BP(25)-CNN-BP(25), baseline, SNR: 0.0~3.0 (!)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Function is set to GenData\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "URLLC Interference: True\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-26 06:56:41.122614: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-26 06:56:41.811011: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 314.31MiB\n",
      "2018-06-26 06:56:41.811052: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-26 06:56:42.150302: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-26 06:56:42.150344: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-26 06:56:42.150368: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-26 06:56:42.150716: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 15 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-26 06:56:43.376279: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-26 06:56:43.376376: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-26 06:56:43.376403: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-26 06:56:43.376410: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-26 06:56:43.376649: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 15 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-26 06:56:43.395646: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-26 06:56:43.395706: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-26 06:56:43.395715: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-26 06:56:43.395739: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-26 06:56:43.395958: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 15 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "2018-06-26 06:56:55.160298: W tensorflow/core/common_runtime/bfc_allocator.cc:275] Allocator (GPU_0_bfc) ran out of memory trying to allocate 1.56MiB.  Current allocation summary follows.\n",
      "2018-06-26 06:56:55.160334: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (256): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160342: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (512): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160348: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (1024): \tTotal Chunks: 3, Chunks in use: 3. 3.8KiB allocated for chunks. 3.8KiB in use in bin. 3.0KiB client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160355: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (2048): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160378: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (4096): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160384: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (8192): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160408: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (16384): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160414: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (32768): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160437: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (65536): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160444: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (131072): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160450: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (262144): \tTotal Chunks: 4, Chunks in use: 4. 1.76MiB allocated for chunks. 1.76MiB in use in bin. 1.76MiB client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160472: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (524288): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160478: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (1048576): \tTotal Chunks: 5, Chunks in use: 5. 7.49MiB allocated for chunks. 7.49MiB in use in bin. 7.49MiB client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160485: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (2097152): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160491: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (4194304): \tTotal Chunks: 1, Chunks in use: 1. 6.06MiB allocated for chunks. 6.06MiB in use in bin. 4.48MiB client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160497: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (8388608): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160503: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (16777216): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160509: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (33554432): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160515: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (67108864): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160521: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (134217728): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160527: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (268435456): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:56:55.160533: I tensorflow/core/common_runtime/bfc_allocator.cc:646] Bin for 1.56MiB was 1.00MiB, Chunk State: \n",
      "2018-06-26 06:56:55.160541: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022a00000 of size 1280\n",
      "2018-06-26 06:56:55.160562: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022a00500 of size 1280\n",
      "2018-06-26 06:56:55.160567: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022a00a00 of size 460800\n",
      "2018-06-26 06:56:55.160572: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022a71200 of size 1632000\n",
      "2018-06-26 06:56:55.160577: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022bff900 of size 460800\n",
      "2018-06-26 06:56:55.160582: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022c70100 of size 1632000\n",
      "2018-06-26 06:56:55.160586: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022dfe800 of size 1280\n",
      "2018-06-26 06:56:55.160591: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022dfed00 of size 460800\n",
      "2018-06-26 06:56:55.160596: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022e6f500 of size 1632000\n",
      "2018-06-26 06:56:55.160600: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022ffdc00 of size 460800\n",
      "2018-06-26 06:56:55.160605: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x1002306e400 of size 1632000\n",
      "2018-06-26 06:56:55.160611: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x100231fcb00 of size 1327104\n",
      "2018-06-26 06:56:55.160633: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10023340b00 of size 6354176\n",
      "2018-06-26 06:56:55.160638: I tensorflow/core/common_runtime/bfc_allocator.cc:671]      Summary of in-use Chunks by size: \n",
      "2018-06-26 06:56:55.160645: I tensorflow/core/common_runtime/bfc_allocator.cc:674] 3 Chunks of size 1280 totalling 3.8KiB\n",
      "2018-06-26 06:56:55.160651: I tensorflow/core/common_runtime/bfc_allocator.cc:674] 4 Chunks of size 460800 totalling 1.76MiB\n",
      "2018-06-26 06:56:55.160657: I tensorflow/core/common_runtime/bfc_allocator.cc:674] 1 Chunks of size 1327104 totalling 1.27MiB\n",
      "2018-06-26 06:56:55.160662: I tensorflow/core/common_runtime/bfc_allocator.cc:674] 4 Chunks of size 1632000 totalling 6.23MiB\n",
      "2018-06-26 06:56:55.160668: I tensorflow/core/common_runtime/bfc_allocator.cc:674] 1 Chunks of size 6354176 totalling 6.06MiB\n",
      "2018-06-26 06:56:55.160675: I tensorflow/core/common_runtime/bfc_allocator.cc:678] Sum Total of in-use chunks: 15.31MiB\n",
      "2018-06-26 06:56:55.160683: I tensorflow/core/common_runtime/bfc_allocator.cc:680] Stats: \n",
      "Limit:                    16056320\n",
      "InUse:                    16056320\n",
      "MaxInUse:                 16056320\n",
      "NumAllocs:                      17\n",
      "MaxAllocSize:              6354176\n",
      "\n",
      "2018-06-26 06:56:55.160694: W tensorflow/core/common_runtime/bfc_allocator.cc:279] ******************************************************************************************xxxxxxxxxx\n",
      "2018-06-26 06:56:55.160749: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at matmul_op.cc:479 : Resource exhausted: OOM when allocating tensor with shape[2040,200] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc\n",
      "Traceback (most recent call last):\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1322, in _do_call\n",
      "    return fn(*args)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1307, in _run_fn\n",
      "    options, feed_dict, fetch_list, target_list, run_metadata)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1409, in _call_tf_sessionrun\n",
      "    run_metadata)\n",
      "tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[2040,200] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc\n",
      "\t [[Node: MatMul_1 = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device=\"/job:localhost/replica:0/task:0/device:GPU:0\"](MatMul_1/a, Variable/read)]]\n",
      "Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\n",
      "\n",
      "\n",
      "During handling of the above exception, another exception occurred:\n",
      "\n",
      "Traceback (most recent call last):\n",
      "  File \"main.py\", line 34, in <module>\n",
      "    top_config.currently_trained_net_id, 'Training', noise_io, top_config.model_id)\n",
      "  File \"/workspace/BPCNN/Iterative_BP_CNN.py\", line 247, in generate_noise_samples\n",
      "    u_BP_decoded = bp_decoder.decode(LLR.astype(np.float32), bp_iter_num[iter])\n",
      "  File \"/workspace/BPCNN/BP_Decoder.py\", line 147, in decode\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    self.sess.run(self.xe_v2c_pre_iter_assign)\r\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 900, in run\r\n",
      "    run_metadata_ptr)\r\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1135, in _run\r\n",
      "    feed_dict_tensor, options, run_metadata)\r\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1316, in _do_run\r\n",
      "    run_metadata)\r\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1335, in _do_call\r\n",
      "    raise type(e)(node_def, op, message)\r\n",
      "tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[2040,200] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc\r\n",
      "\t [[Node: MatMul_1 = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device=\"/job:localhost/replica:0/task:0/device:GPU:0\"](MatMul_1/a, Variable/read)]]\r\n",
      "Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\r\n",
      "\r\n",
      "\r\n",
      "Caused by op 'MatMul_1', defined at:\r\n",
      "  File \"main.py\", line 34, in <module>\r\n",
      "    top_config.currently_trained_net_id, 'Training', noise_io, top_config.model_id)\r\n",
      "  File \"/workspace/BPCNN/Iterative_BP_CNN.py\", line 211, in generate_noise_samples\r\n",
      "    bp_decoder = BP_Decoder.BP_NetDecoder(H_matrix, batch_size_each_SNR)\r\n",
      "  File \"/workspace/BPCNN/BP_Decoder.py\", line 86, in __init__\r\n",
      "    self.llr_into_bp_net, self.xe_0, self.xe_v2c_pre_iter_assign, self.start_next_iteration, self.dec_out = self.build_network()\r\n",
      "  File \"/workspace/BPCNN/BP_Decoder.py\", line 123, in build_network\r\n",
      "    xe_0 = tf.matmul(self.H_x_to_xe0, llr_into_bp_net)\r\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/math_ops.py\", line 2122, in matmul\r\n",
      "    a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name)\r\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_math_ops.py\", line 4279, in mat_mul\r\n",
      "    name=name)\r\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py\", line 787, in _apply_op_helper\r\n",
      "    op_def=op_def)\r\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py\", line 3392, in create_op\r\n",
      "    op_def=op_def)\r\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py\", line 1718, in __init__\r\n",
      "    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access\r\n",
      "\r\n",
      "ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[2040,200] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc\r\n",
      "\t [[Node: MatMul_1 = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device=\"/job:localhost/replica:0/task:0/device:GPU:0\"](MatMul_1/a, Variable/read)]]\r\n",
      "Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\r\n",
      "\r\n",
      "\r\n",
      "Close a tf session!\r\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func GenData -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\" -URLLC_Intf True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Function is set to Train\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "URLLC Interference: True\n",
      "Construct the data IO class for training!\n",
      "\n",
      "Traceback (most recent call last):\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py\", line 1567, in _create_c_op\n",
      "    c_op = c_api.TF_FinishOperation(op_desc)\n",
      "tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 577 and 576 for 'sub_1' (op: 'Sub') with input shapes: [?,577], [?,576].\n",
      "\n",
      "During handling of the above exception, another exception occurred:\n",
      "\n",
      "Traceback (most recent call last):\n",
      "  File \"main.py\", line 42, in <module>\n",
      "    conv_net.train_network(top_config.model_id)\n",
      "  File \"/workspace/BPCNN/ConvNet.py\", line 182, in train_network\n",
      "    orig_loss_for_test = tf.reduce_mean(tf.square(y_label - x_in))\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/math_ops.py\", line 979, in binary_op_wrapper\n",
      "    return func(x, y, name=name)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_math_ops.py\", line 8009, in sub\n",
      "    \"Sub\", x=x, y=y, name=name)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py\", line 787, in _apply_op_helper\n",
      "    op_def=op_def)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py\", line 3392, in create_op\n",
      "    op_def=op_def)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py\", line 1734, in __init__\n",
      "    control_input_ops)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py\", line 1570, in _create_c_op\n",
      "    raise ValueError(str(e))\n",
      "ValueError: Dimensions must be equal, but are 577 and 576 for 'sub_1' (op: 'Sub') with input shapes: [?,577], [?,576].\n",
      "Delete the data IO class!\n",
      "\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Train -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\" -URLLC_Intf True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Function is set to Simulation\n",
      "Corr para is set to 0.00\n",
      "eval_SNRs is set to [0.  0.5 1.  1.5 2.  2.5 3. ]\n",
      "Corr para for simulation is set to 0.00\n",
      "BP iter for gen data is set to: [25]\n",
      "BP iter for simulation is set to: [25 25]\n",
      "Normality test: False\n",
      "Normality lambda is set to 0.000000\n",
      "SNR set for generating data is set to [0.  0.5 1.  1.5 2.  2.5 3. ].\n",
      "URLLC Interference: True\n",
      "Correlation function of channel noise: \n",
      "[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      "2018-06-26 06:57:00.304346: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2018-06-26 06:57:01.003325: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: \n",
      "name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53\n",
      "pciBusID: 0000:0a:00.0\n",
      "totalMemory: 15.77GiB freeMemory: 314.31MiB\n",
      "2018-06-26 06:57:01.003378: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-26 06:57:01.343888: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-26 06:57:01.343929: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-26 06:57:01.343938: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-26 06:57:01.344216: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 15 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Real simutimes: 15000\n",
      "Construct the Matrics H class!\n",
      "\n",
      "return Matrics C-V successfully!\n",
      "\n",
      "return Matrics V-C successfully!\n",
      "\n",
      "2018-06-26 06:57:03.116064: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0\n",
      "2018-06-26 06:57:03.116168: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
      "2018-06-26 06:57:03.116178: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 \n",
      "2018-06-26 06:57:03.116201: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N \n",
      "2018-06-26 06:57:03.116432: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 15 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:0a:00.0, compute capability: 7.0)\n",
      "Open a tf session!\n",
      "2018-06-26 06:57:13.318356: W tensorflow/core/common_runtime/bfc_allocator.cc:275] Allocator (GPU_0_bfc) ran out of memory trying to allocate 38.91MiB.  Current allocation summary follows.\n",
      "2018-06-26 06:57:13.318423: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (256): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318433: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (512): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318457: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (1024): \tTotal Chunks: 2, Chunks in use: 2. 2.5KiB allocated for chunks. 2.5KiB in use in bin. 2.0KiB client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318464: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (2048): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318488: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (4096): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318495: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (8192): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318519: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (16384): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318525: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (32768): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318532: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (65536): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318538: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (131072): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318544: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (262144): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318551: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (524288): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318557: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (1048576): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318563: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (2097152): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318570: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (4194304): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318578: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (8388608): \tTotal Chunks: 1, Chunks in use: 1. 15.31MiB allocated for chunks. 15.31MiB in use in bin. 10.99MiB client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318585: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (16777216): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318592: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (33554432): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318599: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (67108864): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318605: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (134217728): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318612: I tensorflow/core/common_runtime/bfc_allocator.cc:630] Bin (268435456): \tTotal Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.\n",
      "2018-06-26 06:57:13.318619: I tensorflow/core/common_runtime/bfc_allocator.cc:646] Bin for 38.91MiB was 32.00MiB, Chunk State: \n",
      "2018-06-26 06:57:13.318627: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022a00000 of size 1280\n",
      "2018-06-26 06:57:13.318633: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022a00500 of size 1280\n",
      "2018-06-26 06:57:13.318639: I tensorflow/core/common_runtime/bfc_allocator.cc:665] Chunk at 0x10022a00a00 of size 16053760\n",
      "2018-06-26 06:57:13.318644: I tensorflow/core/common_runtime/bfc_allocator.cc:671]      Summary of in-use Chunks by size: \n",
      "2018-06-26 06:57:13.318651: I tensorflow/core/common_runtime/bfc_allocator.cc:674] 2 Chunks of size 1280 totalling 2.5KiB\n",
      "2018-06-26 06:57:13.318657: I tensorflow/core/common_runtime/bfc_allocator.cc:674] 1 Chunks of size 16053760 totalling 15.31MiB\n",
      "2018-06-26 06:57:13.318663: I tensorflow/core/common_runtime/bfc_allocator.cc:678] Sum Total of in-use chunks: 15.31MiB\n",
      "2018-06-26 06:57:13.318672: I tensorflow/core/common_runtime/bfc_allocator.cc:680] Stats: \n",
      "Limit:                    16056320\n",
      "InUse:                    16056320\n",
      "MaxInUse:                 16056320\n",
      "NumAllocs:                       3\n",
      "MaxAllocSize:             16053760\n",
      "\n",
      "2018-06-26 06:57:13.318681: W tensorflow/core/common_runtime/bfc_allocator.cc:279] ************************************************************************xxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
      "2018-06-26 06:57:13.318712: W tensorflow/core/framework/op_kernel.cc:1295] OP_REQUIRES failed at constant_op.cc:75 : Resource exhausted: OOM when allocating tensor of shape [2040,5000] and type float\n",
      "2018-06-26 06:57:13.345022: E tensorflow/core/common_runtime/executor.cc:660] Executor failed to create kernel. Resource exhausted: OOM when allocating tensor of shape [2040,5000] and type float\n",
      "\t [[Node: Variable_1/initial_value = Const[dtype=DT_FLOAT, value=Tensor<type: float shape: [2040,5000] values: [1 1 1]...>, _device=\"/job:localhost/replica:0/task:0/device:GPU:0\"]()]]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Traceback (most recent call last):\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1322, in _do_call\n",
      "    return fn(*args)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1307, in _run_fn\n",
      "    options, feed_dict, fetch_list, target_list, run_metadata)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1409, in _call_tf_sessionrun\n",
      "    run_metadata)\n",
      "tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor of shape [2040,5000] and type float\n",
      "\t [[Node: Variable_1/initial_value = Const[dtype=DT_FLOAT, value=Tensor<type: float shape: [2040,5000] values: [1 1 1]...>, _device=\"/job:localhost/replica:0/task:0/device:GPU:0\"]()]]\n",
      "\n",
      "During handling of the above exception, another exception occurred:\n",
      "\n",
      "Traceback (most recent call last):\n",
      "  File \"main.py\", line 48, in <module>\n",
      "    ibd.analyze_residual_noise(code, top_config, net_config, simutimes_for_anal_res_power, batch_size)\n",
      "  File \"/workspace/BPCNN/Iterative_BP_CNN.py\", line 299, in analyze_residual_noise\n",
      "    bp_decoder = BP_Decoder.BP_NetDecoder(H_matrix, batch_size)\n",
      "  File \"/workspace/BPCNN/BP_Decoder.py\", line 92, in __init__\n",
      "    self.sess.run(init)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 900, in run\n",
      "    run_metadata_ptr)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1135, in _run\n",
      "    feed_dict_tensor, options, run_metadata)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1316, in _do_run\n",
      "    run_metadata)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py\", line 1335, in _do_call\n",
      "    raise type(e)(node_def, op, message)\n",
      "tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor of shape [2040,5000] and type float\n",
      "\t [[Node: Variable_1/initial_value = Const[dtype=DT_FLOAT, value=Tensor<type: float shape: [2040,5000] values: [1 1 1]...>, _device=\"/job:localhost/replica:0/task:0/device:GPU:0\"]()]]\n",
      "\n",
      "Caused by op 'Variable_1/initial_value', defined at:\n",
      "  File \"main.py\", line 48, in <module>\n",
      "    ibd.analyze_residual_noise(code, top_config, net_config, simutimes_for_anal_res_power, batch_size)\n",
      "  File \"/workspace/BPCNN/Iterative_BP_CNN.py\", line 299, in analyze_residual_noise\n",
      "    bp_decoder = BP_Decoder.BP_NetDecoder(H_matrix, batch_size)\n",
      "  File \"/workspace/BPCNN/BP_Decoder.py\", line 86, in __init__\n",
      "    self.llr_into_bp_net, self.xe_0, self.xe_v2c_pre_iter_assign, self.start_next_iteration, self.dec_out = self.build_network()\n",
      "  File \"/workspace/BPCNN/BP_Decoder.py\", line 124, in build_network\n",
      "    xe_v2c_pre_iter = tf.Variable(np.ones([self.num_all_edges, self.batch_size], dtype=np.float32)) # the v->c messages of the previous iteration\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/variables.py\", line 235, in __init__\n",
      "    constraint=constraint)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/variables.py\", line 355, in _init_from_args\n",
      "    initial_value, name=\"initial_value\", dtype=dtype)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py\", line 1014, in convert_to_tensor\n",
      "    as_ref=False)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py\", line 1104, in internal_convert_to_tensor\n",
      "    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/constant_op.py\", line 235, in _constant_tensor_conversion_function\n",
      "    return constant(v, dtype=dtype, name=name)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/constant_op.py\", line 220, in constant\n",
      "    name=name).outputs[0]\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py\", line 3392, in create_op\n",
      "    op_def=op_def)\n",
      "  File \"/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py\", line 1718, in __init__\n",
      "    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access\n",
      "\n",
      "ResourceExhaustedError (see above for traceback): OOM when allocating tensor of shape [2040,5000] and type float\n",
      "\t [[Node: Variable_1/initial_value = Const[dtype=DT_FLOAT, value=Tensor<type: float shape: [2040,5000] values: [1 1 1]...>, _device=\"/job:localhost/replica:0/task:0/device:GPU:0\"]()]]\n",
      "\n",
      "Close a tf session!\n"
     ]
    }
   ],
   "source": [
    "!python main.py -Func Simulation -CorrPara 0.0 -EvalSNR \"0 0.5 1 1.5 2 2.5 3\" -SimuCorrPara 0.0 -BP_IterForGenData 25 -BP_IterForSimu \"25 25\" -NormTest False -NormLambda 0 -SNR_GenData \"0 0.5 1 1.5 2 2.5 3\" -URLLC_Intf True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
